-
Notifications
You must be signed in to change notification settings - Fork 197
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
Allow import foo = require('bar');
syntax
#268
Comments
What kind of problems did you encounter when enabling |
Sure! So our team makes a bunch of libraries in TypeScript that folks use. At one point, we enabled Setting Now this is really only a problem for exported types that appear in the Hope this is useful context Mr Rodriguez :) |
I know that synthetic default imports are very hacky, they fail if there The canonical solution to this is to actually not use default exports when they're not provided, not sure whether this actually helps in your case. An other technique is to manually export the thing that is exported via I would also ask people from the core TS team (andy-ms, sandersn, ...), maybe they have a more helpful advice. |
@JustinBeckwith which rule is causing this? |
Turns out this was a side effect of #270 🤦♂️ This is working right now over in https://github.com/googleapis/nodejs-spanner/pull/536/files |
On master, the
import pLimit = require('p-limit');
is not allowed. I thought - well no big deal - I'll run around to all thed.ts
files that don't support it, and submit a patch. Well - I got this feedback:DefinitelyTyped/DefinitelyTyped#33128
The guidance they provide links to a section here, which basically says to use synthetic default imports:
https://github.com/DefinitelyTyped/DefinitelyTyped#should-i-add-an-empty-namespace-to-a-package-that-doesnt-export-a-module-to-use-es6-style-imports
Well - as we discovered - enabling synthetic default imports has consequences downstream, and cause all sorts of problems.
So I'm left in a bind here. I can't use the
import = require
syntax without an exclusion, I can't modify thed.ts
to use theexport namespace
hack, and I can't allow synthetic default imports.I think we should lift this rule. Thoughts?
The text was updated successfully, but these errors were encountered: