From b96c8d58d5673496c40d0ea1683a4b463d117cf1 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 22 Dec 2016 11:22:45 -0500 Subject: [PATCH] Add note to README about default exports. (#13442) --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 8a797169cf..4a988f2ed3 100644 --- a/README.md +++ b/README.md @@ -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`.