Skip to content

Help for localForage #6

@dsebastien

Description

@dsebastien

Hello @blakeembrey,

I would like to get typings for the localForage library and use those in my project.
At first, I tried using tsd and thus the following typings file: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/localForage/localForage.d.ts

Unfortunately, it imports the es6-promise typings and because Angular 2 (which I also use in my project) expose that already, I end up with the dreaded duplicate identifier error (on 'Promise'):

$ tsd install localForage

 - localForage    / localForage
   -> es6-promise > es6-promise

>> running install..

>> written 2 files:

    - es6-promise/es6-promise.d.ts
    - localForage/localForage.d.ts


$ tsc
node_modules/angular2/typings/es6-shim/es6-shim.d.ts(475,11): error TS2300: Duplicate identifier 'Promise'.
node_modules/angular2/typings/es6-shim/es6-shim.d.ts(552,13): error TS2300: Duplicate identifier 'Promise'.
typings/es6-promise/es6-promise.d.ts(11,15): error TS2300: Duplicate identifier 'Promise'.
typings/es6-promise/es6-promise.d.ts(42,16): error TS2300: Duplicate identifier 'Promise'.

Then, since I wanted to give your project a try, I've decided to give it a go, except that I don't really know where to start :)

I first tried a command that failed (can't remember what it was), which led me to fork the registry and try to add a reference towards definitelytyped for localForage: https://github.com/dsebastien/registry-1/commit/828d9998570d4d548f15f9eff9baa8f92e7cc239

Then I found the --ambient flag and realized that it's probably not worth a pull request (?).

Then I've tried typings install localForage --ambient --save which did find the typings on DefinitelyTyped and download those:

$ typings install localForage --ambient --save
? Found typings for localForage in DefinitelyTyped. Ok? Yes
Installing localForage@* (DefinitelyTyped)...

References (not installed):
  github:DefinitelyTyped/DefinitelyTyped/es6-promise/es6-promise.d.ts#c192586e9e3c5180e271dbd21e7295aaf1dcdbb6 (from localForage)

localForage
└── (No dependencies)

Unfortunately, tsc complains a bit afterwards:

$ tsc
typings/browser/ambient/localForage/localForage.d.ts(10,5): error TS2300: Duplicate identifier 'driver'.
typings/browser/ambient/localForage/localForage.d.ts(12,5): error TS2300: Duplicate identifier 'name'.
typings/browser/ambient/localForage/localForage.d.ts(14,5): error TS2300: Duplicate identifier 'size'.
typings/browser/ambient/localForage/localForage.d.ts(16,5): error TS2300: Duplicate identifier 'storeName'.
typings/browser/ambient/localForage/localForage.d.ts(18,5): error TS2300: Duplicate identifier 'version'.
typings/browser/ambient/localForage/localForage.d.ts(20,5): error TS2300: Duplicate identifier 'description'.
typings/browser/ambient/localForage/localForage.d.ts(24,5): error TS2300: Duplicate identifier '_driver'.
typings/browser/ambient/localForage/localForage.d.ts(28,5): error TS2300: Duplicate identifier '_support'.
typings/browser/ambient/localForage/localForage.d.ts(46,5): error TS2300: Duplicate identifier 'LOCALSTORAGE'.
typings/browser/ambient/localForage/localForage.d.ts(47,5): error TS2300: Duplicate identifier 'WEBSQL'.
typings/browser/ambient/localForage/localForage.d.ts(48,5): error TS2300: Duplicate identifier 'INDEXEDDB'.
typings/browser/ambient/localForage/localForage.d.ts(96,5): error TS2300: Duplicate identifier 'default'.
typings/main/ambient/localForage/localForage.d.ts(10,5): error TS2300: Duplicate identifier 'driver'.
typings/main/ambient/localForage/localForage.d.ts(12,5): error TS2300: Duplicate identifier 'name'.
typings/main/ambient/localForage/localForage.d.ts(14,5): error TS2300: Duplicate identifier 'size'.
typings/main/ambient/localForage/localForage.d.ts(16,5): error TS2300: Duplicate identifier 'storeName'.
typings/main/ambient/localForage/localForage.d.ts(18,5): error TS2300: Duplicate identifier 'version'.
typings/main/ambient/localForage/localForage.d.ts(20,5): error TS2300: Duplicate identifier 'description'.
typings/main/ambient/localForage/localForage.d.ts(24,5): error TS2300: Duplicate identifier '_driver'.
typings/main/ambient/localForage/localForage.d.ts(28,5): error TS2300: Duplicate identifier '_support'.
typings/main/ambient/localForage/localForage.d.ts(46,5): error TS2300: Duplicate identifier 'LOCALSTORAGE'.
typings/main/ambient/localForage/localForage.d.ts(47,5): error TS2300: Duplicate identifier 'WEBSQL'.
typings/main/ambient/localForage/localForage.d.ts(48,5): error TS2300: Duplicate identifier 'INDEXEDDB'.
typings/main/ambient/localForage/localForage.d.ts(96,5): error TS2300: Duplicate identifier 'default'.

Now I'm wondering how to fix this. I assume that removing either the contents of the browser folder or the ambient one would fix this, but is it the way to do?
Am I missing some other flag?

Or do I need to create some other type of module (i.e., non-ambient) like https://github.com/typings/typed-debug from the info I have on DefinitelyTyped?

Any pointers will be very appreciated :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions