Skip to content

Commit

Permalink
docs(README): update Typescript notice for v2.0 (#608)
Browse files Browse the repository at this point in the history
* docs(README): update Typescript notice for v2.0

* docs(README.Typescript): add allowSyntheticDefaultImports note
  • Loading branch information
thgreasi committed Oct 15, 2016
1 parent b82d9e5 commit 41ec76c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions README.md
Expand Up @@ -171,15 +171,18 @@ installed (eg. `npm install --save-dev babel-plugin-system-import-transformer`).

## TypeScript

To import localForage in TypeScript use:
If you have the [`allowSyntheticDefaultImports` compiler option](https://www.typescriptlang.org/docs/handbook/compiler-options.html) set to `true` in your [tsconfig.json](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (supported in TypeScript v1.8+), you should use:

```javascript
import * as localForage from "localforage";
import localForage from "localforage";
```

For older versions of Typescript, where ES6 style imports are not supported for UMD modules like localForage, you should use:
Otherwise you should use one of the following:

```javascript
import * as localForage from "localforage";
// or, in case that the typescript version that you are using
// doesn't support ES6 style imports for UMD modules like localForage
import localForage = require("localforage");
```

Expand Down

0 comments on commit 41ec76c

Please sign in to comment.