Add note to README about default exports. (#13442)

This commit is contained in:
Andy
2016-12-22 11:22:45 -05:00
committed by GitHub
parent 25ef9e6de6
commit b96c8d58d5

View File

@@ -212,6 +212,12 @@ Here are the [currently requested definitions](https://github.com/DefinitelyType
If types are part of a web standard, they should be contributed to [TSJS-lib-generator](https://github.com/Microsoft/TSJS-lib-generator) so that they can become part of the default `lib.dom.d.ts`.
### A package uses `export =`, but I prefer to use default imports. Can I change `export =` to `export default`?
If default imports work in your environment, consider turning on the [`--allowSyntheticDefaultImports`](http://www.typescriptlang.org/docs/handbook/compiler-options.html) compiler option.
Do not change the type definition if it is accurate.
For an NPM package, `export =` is accurate if `node -p 'require("foo")'` is the export, and `export default` is accurate if `node -p 'require("foo").default'` is the export.
#### I want to use features from TypeScript 2.1.
Then you will have to add a comment to your definition header: `// TypeScript Version: 2.1`.