Repository navigation
Ts 3.7-beta support #32962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ts 3.7-beta support #32962
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |
| import {Type} from '../interface/type'; | ||
| import {TypeDecorator, makeDecorator} from '../util/decorators'; | ||
|
|
||
| import {InjectableType, getInjectableDef, ɵɵInjectableDef, ɵɵdefineInjectable} from './interface/defs'; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix for Listed under breaking changes in https://devblogs.microsoft.com/typescript/announcing-typescript-3-7-beta/. |
||
| import {getInjectableDef, ɵɵInjectableDef, ɵɵdefineInjectable} from './interface/defs'; | ||
| import {ClassSansProvider, ConstructorSansProvider, ExistingSansProvider, FactorySansProvider, StaticClassSansProvider, ValueSansProvider} from './interface/provider'; | ||
| import {compileInjectable as render3CompileInjectable} from './jit/injectable'; | ||
| import {convertInjectableProviderToFactory} from './util'; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1282,7 +1282,7 @@ function saveNameToExportMap( | |||||||||
| exportsMap[def.exportAs[i]] = index; | ||||||||||
| } | ||||||||||
| } | ||||||||||
| if ((def as ComponentDef<any>).template) exportsMap[''] = index; | ||||||||||
| exportsMap[''] = index; | ||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix for Listed under breaking changes in https://devblogs.microsoft.com/typescript/announcing-typescript-3-7-beta/.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
or
Suggested change
(which is the alternative workaround in the notes)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The cast to Shouldn't the cast be something different then?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that pattern is a bit misleading. In this case, the cast is there as an assumption of it indeed being a This pattern is often used in functions with type predicates: export function isComponentDef<T>(def: DirectiveDef<T>|ComponentDef<T>): def is ComponentDef<T> {
return (def as ComponentDef<T>).template !== undefined;
}In this case however, the compiler requires the return type to be boolean, so the original guard as written before you changed it would not have compiled in the type guard. I guess the extra function is omitted for code size (although I'm not sure on that one). The benefit of the "assumed cast" is that there's proper reference tracking, i.e. IDEs know that the |
||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #32962 (comment)