Arthur Mougin
Arthur Mougin•5w ago

threejs, typescript and vite => everything threejs is any

Hi all, I am coding a dead simple threejs experience where I hoped to be able to use typescript. But all that's imported from the three import is considered as any and there is no way to navigate to the source definition :/ Here is the project config: Deno 2.1.7 deno.json
{
"tasks": {
"dev": "deno run -A --node-modules-dir npm:vite",
"build": "deno run -A --node-modules-dir npm:vite build",
"preview": "deno run -A --node-modules-dir npm:vite preview",
"serve": "deno run --allow-net --allow-read jsr:@std/http@1/file-server dist/"
},
"compilerOptions": {
"lib": ["ES2020", "DOM", "DOM.Iterable"]
},
"imports": {
"@deno/vite-plugin": "npm:@deno/vite-plugin@^1.0.0",
"@types/three": "npm:@types/three@^0.172.0",
"three": "npm:three@^0.172.0",
"vite": "npm:vite@^6.0.1"
},
"lint": {
"rules":{
"exclude": ["no-window", "no-window-prefix"]
}
}
}
{
"tasks": {
"dev": "deno run -A --node-modules-dir npm:vite",
"build": "deno run -A --node-modules-dir npm:vite build",
"preview": "deno run -A --node-modules-dir npm:vite preview",
"serve": "deno run --allow-net --allow-read jsr:@std/http@1/file-server dist/"
},
"compilerOptions": {
"lib": ["ES2020", "DOM", "DOM.Iterable"]
},
"imports": {
"@deno/vite-plugin": "npm:@deno/vite-plugin@^1.0.0",
"@types/three": "npm:@types/three@^0.172.0",
"three": "npm:three@^0.172.0",
"vite": "npm:vite@^6.0.1"
},
"lint": {
"rules":{
"exclude": ["no-window", "no-window-prefix"]
}
}
}
vite.config.ts
import { defineConfig } from 'vite'
import deno from '@deno/vite-plugin'

// https://vite.dev/config/
export default defineConfig({
plugins: [deno()],
})
import { defineConfig } from 'vite'
import deno from '@deno/vite-plugin'

// https://vite.dev/config/
export default defineConfig({
plugins: [deno()],
})
What am I missing ? I also have copilot but he wont autocomplete anything as well but that's another problem
6 Replies
©TriMoon™
©TriMoon™•4w ago
What am I missing ?
Maybe this part: Suppling "types" in deno.json I'm not 100% sure though, as i am still a noob with deno and typescript 😉
Deno
Configuring TypeScript
In-depth documentation, guides, and reference materials for building secure, high-performance JavaScript and TypeScript applications with Deno
Arthur Mougin
Arthur MouginOP•4w ago
The example is for custom types, but the one i needed was from npm:@types/three :/ I don't see how your example would apply here The fix i used was to move the dependencies in a package.json..
halfByteMedic
halfByteMedic•3w ago
This is the same problem you might have seen that everyone has with react. Deno does not know to apply a @types package to a non-typedpackage.
halfByteMedic
halfByteMedic•3w ago
Deno
TypeScript support
In-depth documentation, guides, and reference materials for building secure, high-performance JavaScript and TypeScript applications with Deno
halfByteMedic
halfByteMedic•3w ago
Here's a hack I found that should also work for any other non-typed package.
halfByteMedic
halfByteMedic•3w ago

Did you find this page helpful?