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

import() causing TS to throw method on type error #129

Closed
wants to merge 1 commit into from

Conversation

thedevelopnik
Copy link
Contributor

@thedevelopnik thedevelopnik commented Dec 26, 2017

Having trouble getting it to recognize methods on the dynamically imported class.

See comments on #121

@masters3d
Copy link
Contributor

try changing the module target to esnext

Many bundlers have support for automatically splitting output bundles based on these import expressions, so consider using this new feature with the esnext module target.

@masters3d
Copy link
Contributor

"target": "es2017",

@masters3d
Copy link
Contributor

@masters3d
Copy link
Contributor

also module needs to be esnext

"module": "commonjs",

@masters3d
Copy link
Contributor

Reopen when you get a chance to work on it :)

@masters3d masters3d closed this Jan 1, 2018
@masters3d masters3d deleted the add-dynamic-import branch January 1, 2018 03:04
@thedevelopnik
Copy link
Contributor Author

Yep, sorry, that's today.

Changed the target and module props to esnext in tsconfig.json. That did get it a step further, but hit a new roadblock. This feature seems to be made more for dynamically importing guaranteed resources than for contingently importing resources that may be missing. If you delete acronym.example.ts or remove all code that exports anything (from that or acronym.ts), then TS won't compile because the module doesn't exist.

Since the point of the story was to allow it to import someone's work once they'd gotten rid of, or in the absence of, the example, I don't think this will fulfill that goal, so I'm going to leave it closed for now unless I have an epiphany.

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

Successfully merging this pull request may close these issues.

2 participants