DeloitteAU / react-habitat

⚛️ 🛅 A React DOM Bootstrapper designed to harmonise a hybrid 'CMS + React' application.
Other
262 stars 42 forks source link

Update type definition #10

Closed theladyjaye closed 7 years ago

theladyjaye commented 7 years ago

@jennasalau I apologize for not being more clear, I think what I said led you astray on your README update. Completely my fault.

Prior to this pull request, you would have needed to go though ReactHabitat.default because of that Babel thing. Specifically this line in the compiled output:

https://github.com/DeloitteDigitalAPAC/react-habitat/blob/master/lib/index.js#L24

module.exports = exports['default'];

For TypeScript that is the offending line. With the type definition update in this PR that is no longer required. The user can:

import * as ReactHabitat from 'react-habitat';

And TypeScript gets what we mean.

Again I apologize, it's a strange issue to be sure and it's purely a TypeScript thing made even more esoteric that it's a TypeScript thing ONLY when the code is compiled by Babel with a certain export style. hahahahaha... Hooray for interop between 2 transpiled things!

jennasalau commented 7 years ago

Ahh lol okay thanks for clearing that up.. do you think its worth noting that pattern of TypeScript import in the docs?

I think we inadvertently introduced this bug resolving https://github.com/DeloitteDigitalAPAC/react-habitat/issues/4