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
{{ message }}
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
// TODO(lucassloan): goog.Promise has bad types that are coerced to any, so explicitly emit any
// and change to the proper type (value: googPromise< T , any > | T): googPromise<T, any>
// when the callers have been fixed.
I don't know why it has to return any and what the "when the callers have been fixed" means. (about Google internal code?)
I think goog.Promise and goog.Thenable should be fixed like:
The externs for IThenable::then, Promise::catch and Promise::then in Closure Compiler were changed, adding REJECTED_VALUE to the template. google/closure-compiler@b3df223
@teppeis Thanks for looking into this. Yes, the comment refers to google internal code, which is the primary consumer of clutz generated .d.ts files. Having 'any's was a temporary solution as we were working through getting --partial working and indeed there are many possible improvements.
Unfortunately, each improvement has to be weighted against how much current violations we have in our giant codebase and how much work it is to roll it out.
Always feel free to send me a PR and I will do that evaluation and let you know. Sometimes the answer would be that it would be prohibitively hard. I just did that for #830 and I can tell you that it is fine. Likely changing the return from ':any' to a proper type would not be, but again if you send me a PR I would follow up with describing common failure patterns. Often people forget that in real world codebases, users can mix up to 4 types of promises:
TS Promises
JS promises (translated through clutz)
AngularJS promises described by angularjs.d.ts
AngularJS promises (described by externs translated through clutz).
They are mostly runtime compatible (at least uses expect them to), so any change that makes them type-checking incompatible runs afoul of lots of existing code.
Activity
teppeis commentedon Dec 10, 2018
#689 introduced the type definition.
I don't know why it has to return
anyand what the "when the callers have been fixed" means. (about Google internal code?)I think
goog.Promiseandgoog.Thenableshould be fixed like:sample code in playground
@rkirov @LucasSloan How about this? Can I send PR to fix it?
teppeis commentedon Jan 9, 2019
The externs for
IThenable::then,Promise::catchandPromise::thenin Closure Compiler were changed, addingREJECTED_VALUEto the template.google/closure-compiler@b3df223
rkirov commentedon Jan 16, 2019
@teppeis Thanks for looking into this. Yes, the comment refers to google internal code, which is the primary consumer of clutz generated .d.ts files. Having 'any's was a temporary solution as we were working through getting
--partialworking and indeed there are many possible improvements.Unfortunately, each improvement has to be weighted against how much current violations we have in our giant codebase and how much work it is to roll it out.
Always feel free to send me a PR and I will do that evaluation and let you know. Sometimes the answer would be that it would be prohibitively hard. I just did that for #830 and I can tell you that it is fine. Likely changing the return from ':any' to a proper type would not be, but again if you send me a PR I would follow up with describing common failure patterns. Often people forget that in real world codebases, users can mix up to 4 types of promises:
They are mostly runtime compatible (at least uses expect them to), so any change that makes them type-checking incompatible runs afoul of lots of existing code.