PeculiarVentures / webcrypto-liner

webcrypto-liner is a polyfill that let's down-level User Agents (like IE/Edge) use libraries that depend on WebCrypto. (Keywords: Javascript, WebCrypto, Shim, Polyfill)
MIT License
149 stars 26 forks source link

Incompatible with TypeScript 4.4 #89

Open kumaheiyama opened 2 years ago

kumaheiyama commented 2 years ago

When using webcrypto-liner with typescript >4.2.4 I get the same error as discussed in this webcrypto-core issue.

Looking at the webcrypto-liner package.json it is still using "webcrypto-core": "^1.2.0"

kumaheiyama commented 2 years ago

I tried forking the repo and updating to webcrypto-core 1.2.1, and the build works. However I'm getting the following error message when trying with the latest 1.4.0:

src/lib.ts → build/index.js, build/index.es.js...
[!] (plugin rpt2) Error: C:/Source/webcrypto-liner/src/subtle.ts(223,26): semantic error TS2339: Property 'apply' does not exist on type '((algorithm: AlgorithmIdentifier, data: BufferSource, ...args: any[]) => Promise<ArrayBuffer>) | ProviderStorage | ... 10 more ... | ((format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsag...'.
  Property 'apply' does not exist on type 'ProviderStorage'.
src\subtle.ts
Error: C:/Source/webcrypto-liner/src/subtle.ts(223,26): semantic error TS2339: Property 'apply' does not exist on type '((algorithm: AlgorithmIdentifier, data: BufferSource, ...args: any[]) => Promise<ArrayBuffer>) | ProviderStorage | ... 10 more ... | ((format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsag...'.  Property 'apply' does not exist on type 'ProviderStorage'.
    at error (C:\Source\webcrypto-liner\node_modules\rollup\dist\shared\rollup.js:5239:30)
microshine commented 2 years ago

@kumaheiyama I've published the fixed version webcrypto-liner@1.3.0. Please try it

kumaheiyama commented 2 years ago

Sorry for late response, seems to be working with @1.3.1! Thanks @microshine