| name | types-three-skilld |
| description | ALWAYS use when writing code importing "@types/three". Consult for debugging, best practices, or modifying @types/three, types/three, types three, DefinitelyTyped. |
| metadata | {"version":"0.184.1","generated_by":"Anthropic · Haiku 4.5","generated_at":"2026-05-31T00:00:00.000Z"} |
DefinitelyTyped/DefinitelyTyped @types/three@0.184.1
Tags: ts2.5: 0.92.22, ts2.3: 0.92.22, ts2.7: 0.92.22
References: package.json • README • Docs • Issues • Discussions • Releases
Search
Use skilld search "query" -p @types/three instead of grepping .skilld/ directories. Run skilld search --guide -p @types/three for full syntax, filters, and operators.
API Changes
This section documents version-specific API changes for @types/three v0.184.1, focusing on breaking changes and dependency updates that affect type definitions.
-
BREAKING: @webgpu/types dependency removed from package.json in v0.184.0 — GPUDevice and GPUCanvasContext are now empty stub interfaces in WebGPUBackend.d.ts. Users requiring proper WebGPU types must install @webgpu/types manually. This resolves conflicts with TypeScript 6's built-in WebGPU types source
-
FIXED: Scene<TEventMap> generic parameter — In v0.183.1, the module augmentation in NodeManager.d.ts caused VSCode to resolve to a non-generic Scene interface instead of the generic class declaration, breaking code like scene: THREE.Scene<THREE.Object3DEventMap>. Fixed in v0.184.0 to properly preserve generic type parameters source
Also changed: SpotLightNode module augmentation issues in r177+ related to three.js versions (not a type definition change)
@types/three v0.184.1 Best Practices
Best Practices
-
Parametrize event listeners with EventDispatcher's generic event map types for compile-time event validation — use EventDispatcher<TEventMap> where TEventMap defines valid event types like { added: {}; removed: {} } to enable type-safe addEventListener() and prevent misspelled event names source
-
Scene has a generic event map parameter despite simple appearance — annotate with Scene<TEventMap> when dispatching custom events or handling event maps, not plain Scene source
-
Always explicitly type Texture when storing image sources — use Texture<HTMLImageElement> for DOM images or Texture<HTMLCanvasElement> for canvas sources to enable proper memory management and disposal patterns source
-
Use loadAsync() instead of .load() callbacks when you need Promise-based async handling — loaders provide both callback-based .load(url, onLoad?, onProgress?, onError?) and Promise-based .loadAsync(url, onProgress?) patterns source
-
Use Loader's two-parameter generics for type-safe loading — Loader<TData, TUrl> allows constraining both the return type (TData, default unknown) and URL type (TUrl, default string) for custom loader implementations source
-
Chain loader configuration methods for readable setup — Loader provides fluent API methods like setPath(), setCrossOrigin(), setResourcePath() that return this for chainable configuration source
-
Declare buffer data using the TypedArray union type — use the TypedArray union exported from BufferAttribute (Int8Array through Float64Array) as the standard type for typed array data to ensure GPU compatibility source
-
Extract event type keys with Extract<keyof TEventMap, string> in generic addEventListener implementations — this pattern in EventDispatcher ensures type-safe event listeners with proper event data inference source
-
Extend Object3D with preserved event maps through the hierarchy — when subclassing Object3D, pass the generic type parameter forward like class Group<TEventMap extends Object3DEventMap> extends Object3D<TEventMap> to maintain type safety across inheritance chains source
-
Use readonly type guard properties for safe type discrimination — prefer the readonly isScene: true pattern over string type checks when testing instance types, as the readonly boolean literal provides compile-time narrowing source
-
Define separate JSON serialization interfaces for round-trip data safety — use dedicated *JSON interface types like TextureJSON or SceneJSON for parsing/serialization to match the three.js file format and avoid mixing runtime and persisted representations source
-
Pass LoadingManager to loaders for coordinated resource loading and cross-origin handling — Loader accepts an optional LoadingManager parameter in the constructor to manage request headers, cross-origin policy, and progress tracking across multiple loader instances source
-
Use NormalBufferAttributes or NormalOrGLBufferAttributes type aliases for geometry attribute maps — BufferGeometry defines these aliases to properly type attribute maps that may contain BufferAttribute, InterleavedBufferAttribute, or GLBufferAttribute instances source
-
Install @webgpu/types separately if using WebGPU rendering on TypeScript <6 — @types/three 0.184.0+ removed the @webgpu/types dependency to avoid conflicts with TypeScript 6's native WebGPU types; manually install @webgpu/types for older TypeScript versions when using WebGPURe nderer source