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

Use import statement for TypeScript classes. #1

Open
codeBelt opened this issue Nov 3, 2013 · 2 comments
Open

Use import statement for TypeScript classes. #1

codeBelt opened this issue Nov 3, 2013 · 2 comments

Comments

@codeBelt
Copy link

codeBelt commented Nov 3, 2013

Love what you guys are going with Away3D and TypeScript. I just wanted to point out that you can use the import statement to clean up how TypeScript classes with namespaces are used.

You can use the import statement within the module like:

///<reference path="src/away/containers/View3D.ts" />

module examples
{
    import View3D = away.containers.View3D;

    export class AWDSuzanne
    {
        private _view:View3D;

        constructor()
        {
            this._view = new View3D();
        }
    }
}

I wrote a tutorial about it here:
http://www.codebelt.com/typescript/javascript-namespacing-with-typescript-internal-modules/

@karimbeyrouti
Copy link
Contributor

Thank you Robert.

When we started development of Away3D TypeScript this is something we spent a lot of time looking into ( we started development on Away3D with TypeScript 0.81 ). At the time we encountered some compiler issues with extending classes and clashing variable names for import statements.

If memory serves me right (and it could not), I think the issue was: View3D in your example would throw a compiler error if it was imported in a Parent and Super implementation of a class.

I need to go back and write a simple test/and report a bug (if it's still there) / or propose and update to Away3D lib. Either way - thank you for the post.

@karimbeyrouti
Copy link
Contributor

Happy to say it looks like the issue we had with this in 0.81 is no longer there... needs some more testing - but this is something I would indeed be very happy to use (and we looked into) . Thank you Robert ...

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

No branches or pull requests

2 participants