Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript: module augmentation, add methods and properties to Object3D #13425

Closed
endel opened this issue Feb 24, 2018 · 2 comments
Closed

TypeScript: module augmentation, add methods and properties to Object3D #13425

endel opened this issue Feb 24, 2018 · 2 comments

Comments

@endel
Copy link
Contributor

endel commented Feb 24, 2018

Hello there,

I'm having troubles augmenting definitions for the "three" module.

I'd like to add methods and attributes on THREE.Object3D. I've tried many variations of the following example, but none of them seem to work:

augment.d.ts:

/// <reference types="three" />

declare namespace THREE {
    export interface Object3D {
        addBehaviour (klass: any): any;
        getEntity (): any;
    }
}

Usage:

screen shot 2018-02-24 at 19 20 53

Anyone has experience augmenting THREE definitions on TypeScript?
Cheers!

@endel endel changed the title TypeScript: module augmentation, add TypeScript: module augmentation, add methods and properties to Object3D Feb 24, 2018
@mrdoob mrdoob closed this as completed Feb 24, 2018
@sidroopdaska
Copy link

Did you figure this out?

@endel
Copy link
Contributor Author

endel commented Apr 23, 2018

@sidroopdaska I've found some TypeScript open issues about this. Unfortunately, it's not possible to do this currently because of the way the type definitions are written for three.js.

More info:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants