You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to update the WebCrypto interface definitions, where functions return Promises. If I declare these return values as Promises, tsc will fail to build. If I change this to PromiseLike, it builds fine, but if I am targeting es6 (or using the es6 library via other means), it would be nice to have the return values be actual Promises. Is there a way to specify separate signatures for es5 and es6 libraries?
If it's in a separate file, won't there be conflicting definitions in the eventual lib.es6.d.ts output? In this case, the method signature changes depending on the language level.
if the difference is only in the return types, then we need to to have two separate files that include all definitions. then the build can pick one or the other based on the language version.
Perhaps I'm not properly explaining what I'm worried about. As I understand things, when I add to overridingTypes.json, these changes are reflected both in lib.d.ts and lib.es6.d.ts via dom.generated.d.ts. Let's say we have:
...and that gets put into a dom.es6.d.ts file, won't both versions of the declaration try to end up in lib.es6.d.ts? The first version via the existing mechanism, and the second via the proposed new route?
Perhaps there could be an es6-signatures key that would provide method signatures to be picked up in lieu of the ones specified in signatures?
what i meant is to generate two files here, dom.generated.d.ts and dom.es6.generated.d.ts. the second can be just an augmentation to the first, or it can be a replica of it with only different return types. then in the main ts repo, we would wire the build to pick one or the other based on which lib it is building.
Activity
mhegazy commentedon Jan 13, 2016
We should generate a new file dom.es6.d.ts, that include the definitions that contain es6-specific definitions. and we can wire it in the TS build in https://github.com/Microsoft/TypeScript/blob/master/Jakefile.js#L172
rapropos commentedon Jan 13, 2016
If it's in a separate file, won't there be conflicting definitions in the eventual lib.es6.d.ts output? In this case, the method signature changes depending on the language level.
mhegazy commentedon Jan 13, 2016
if the difference is only in the return types, then we need to to have two separate files that include all definitions. then the build can pick one or the other based on the language version.
rapropos commentedon Jan 13, 2016
Perhaps I'm not properly explaining what I'm worried about. As I understand things, when I add to
overridingTypes.json, these changes are reflected both inlib.d.tsandlib.es6.d.tsviadom.generated.d.ts. Let's say we have:So if there is a new file, say
overridingTypesEs6.json, and I put the following version in it:...and that gets put into a
dom.es6.d.tsfile, won't both versions of the declaration try to end up inlib.es6.d.ts? The first version via the existing mechanism, and the second via the proposed new route?Perhaps there could be an
es6-signatureskey that would provide method signatures to be picked up in lieu of the ones specified insignatures?mhegazy commentedon Jan 14, 2016
what i meant is to generate two files here,
dom.generated.d.tsanddom.es6.generated.d.ts. the second can be just an augmentation to the first, or it can be a replica of it with only different return types. then in the main ts repo, we would wire the build to pick one or the other based on which lib it is building.saschanaz commentedon Mar 27, 2017
Is this fixed by microsoft/TypeScript#14053?
mhegazy commentedon Mar 27, 2017
Yes. we should just use
Promiseeverywhere now.Change SubtleCrypto method return types to Promise (#843)