From 7060d7d30439b4ccba8dcfd548a59a622377d94e Mon Sep 17 00:00:00 2001 From: Cecile Muller Date: Fri, 22 Jun 2018 15:00:08 +0200 Subject: [PATCH] Added `declare module` example in README --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index c41834e..4b219be 100644 --- a/README.md +++ b/README.md @@ -39,3 +39,18 @@ const scene = new Scene(); const renderer = new WebGLRenderer(); const controls = new OrbitControls(); ```` + + +## Typescript + +Until definitions are integrated directly in `@types/three`, add a file `globals.d.ts` +at the root of your project to specify the types of the imports, e.g.: + +````ts +declare module 'three/examples/js/controls/OrbitControls' { + export const OrbitControls: typeof THREE.OrbitControls; +} +```` + +Note that this is *not* required for compiling to JS, it improves Intellisense in your code editor. +