ScalablyTyped/Converter

Some methods in npm `idb` package can't be converted

mohe2015 opened this issue · 2 comments

Hi,

some methods in the https://www.npmjs.com/package/idb package can't be converted. e.g. in IDBPObjectStore the put method fails with the following:

  /**
    * Put an item in the store.
    *
    * Replaces any item with the same key.
    */
  var put: /* import warning: importer.ImportType#apply Failed type conversion: Mode extends 'readonly' ? undefined : (value : idb.idb/build/entry.StoreValue<DBTypes, StoreName>, key : idb.idb/build/entry.StoreKey<DBTypes, StoreName> | std.IDBKeyRange | undefined): std.Promise<idb.idb/build/entry.StoreKey<DBTypes, StoreName>> */ js.Any = js.native

Looks like this is because of the conditional type. I assume that is never gonna be supported?

Just saw

NOTE: Conditional type definitions are impossible to translate to Scala. See [https://www.typescriptlang.org/docs/handbook/2/conditional-types.html](vscode-file://vscode-app/opt/visual-studio-code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html) for an intro. You'll have to cast your way around this structure, unfortunately. TS definition:

Sorry, gonna close this