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 usage with Bable compiled Files #9

Closed
theladyjaye opened this issue Feb 6, 2017 · 2 comments
Closed

Typescript usage with Bable compiled Files #9

theladyjaye opened this issue Feb 6, 2017 · 2 comments

Comments

@theladyjaye
Copy link
Contributor

So Babel does some magic with export default you can see how it conflicts here:

microsoft/TypeScript#5565 (comment)

Supposedly this is being addressed?

babel/babel#2212

Anyway under typescript the example actually becomes:

import * as ReactHabitat from 'react-habitat';
import { Hello } from './components/Hello';

class MyApp extends ReactHabitat.default.Bootstrapper {
    constructor(){
        super();

        // Create a new container builder
        var container = new ReactHabitat.default.Container();

        // Register your top level component(s) (ie mini/child apps)
        container.register('Hello', Hello);

        // Finally, set the container
        this.setContainer(container);
    }
}


// Always export a 'new' instance so it immediately evokes
export default new MyApp();

Note the lookup: ReactHabitat.default.Bootstrapper and ReactHabitat.default.Container()

@theladyjaye
Copy link
Contributor Author

See: #10

@jennasalau
Copy link
Contributor

Thanks so much for your PR! Legend.

This is now resolved in v4.0.2

We will need to have a look at the ugly default issue in a future release. In the mean time I've added notes to the read me.

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