angular-cn/packages/compiler/src
Alex Rickabaugh ed7aa1c3e5 fix(ivy): force new imports for .d.ts files (#25080)
When ngtsc encounters a reference to a type (for example, a Component
type listed in an NgModule declarations array), it traces the import
of that type and attempts to determine the best way to refer to it.

In the event the type is defined in the same file where a reference
is being generated, the identifier of the type is used. If the type
was imported, ngtsc has a choice. It can use the identifier from the
original import, or it can write a new import to the module where the
type came from.

ngtsc has a bug currently when it elects to rely on the user's import.
When writing a .d.ts file, the user's import may have been elided as
the type was not referred to from the type side of the program. Thus,
in .d.ts files ngtsc must always assume the import may not exist, and
generate a new one.

In .js output the import is guaranteed to still exist, so it's
preferable for ngtsc to continue using the existing import if one is
available.

This commit changes how @angular/compiler writes type definitions, and
allows it to use a different expression to write a type definition than
is used to write the value. This allows ngtsc to specify that types in
type definitions should always be imported. A corresponding change to
the staticallyResolve() Reference system allows the choice of which
type of import to use when generating an Expression from a Reference.

PR Close #25080
2018-07-26 16:38:09 -07:00
..
aot fix(compiler): i18n_extractor now outputs the correct source file name (#24885) 2018-07-16 16:09:01 -04:00
compiler_util fix(ivy): correctly bind to component context (#23168) 2018-04-10 13:14:20 -07:00
css_parser build(bazel): Turning on strictPropertyInitialization for Angular. (#24572) 2018-06-25 07:57:13 -07:00
expression_parser test(ivy): add html to ivy ast transformer tests (#23546) 2018-05-09 11:49:18 -07:00
i18n fix(compiler): i18n_extractor now outputs the correct source file name (#24885) 2018-07-16 16:09:01 -04:00
jit feat(compiler): implement "enableIvy" compiler option (#21427) 2018-01-18 18:22:44 -06:00
ml_parser build(bazel): Turning on strictPropertyInitialization for Angular. (#24572) 2018-06-25 07:57:13 -07:00
output fix(ivy): types in .d.ts files should account for generics (#24862) 2018-07-20 11:48:36 -07:00
render3 fix(ivy): force new imports for .d.ts files (#25080) 2018-07-26 16:38:09 -07:00
schema refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
template_parser fix(compiler): fix a few non-tree-shakeable code patterns (#24677) 2018-06-28 17:51:42 -04:00
view_compiler feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
assertions.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
ast_path.ts style: typos fixed - https://github.com/vlajos/misspell-fixer (#22975) 2018-03-27 14:51:53 -04:00
chars.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
compile_metadata.ts build(bazel): Turning on strictPropertyInitialization for Angular. (#24572) 2018-06-25 07:57:13 -07:00
compile_reflector.ts feat(ivy): @NgModule -> ngInjectorDef compilation (#22458) 2018-03-16 12:57:11 -07:00
compiler.ts fix(ivy): force new imports for .d.ts files (#25080) 2018-07-26 16:38:09 -07:00
config.ts refactor(compiler): Drop support for the deprecated `<template>`. Use `<ng-template>` instead (#22783) 2018-03-15 14:52:22 -07:00
constant_pool.ts fix(ivy): use 'typeof' and 'never' for type metadata (#24862) 2018-07-20 11:48:36 -07:00
core.ts feat(ivy): properly apply class="", [class], [class.foo] and [attr.class] bindings (#24822) 2018-07-17 16:33:25 -04:00
directive_normalizer.ts style: typos fixed - https://github.com/vlajos/misspell-fixer (#22975) 2018-03-27 14:51:53 -04:00
directive_resolver.ts feat(compiler): narrow types of expressions used in *ngIf (#20702) 2017-12-08 10:24:26 -08:00
identifiers.ts fix(ivy): correctly export all *Def symbols as private (#24862) 2018-07-20 11:48:36 -07:00
injectable_compiler.ts feat(ivy): support injection even if no injector present (#23345) 2018-04-13 14:29:52 -07:00
injectable_compiler_2.ts fix(ivy): inject() no longer uses default value parameters (#24565) 2018-06-21 13:14:10 -07:00
lifecycle_reflector.ts refactor(compiler): don’t rely on global reflector (#16832) 2017-05-23 10:41:23 -06:00
metadata_resolver.ts style(compiler): fix up grammar in error message (#24201) 2018-05-30 11:24:11 -07:00
ng_module_compiler.ts feat(compiler): lower @NgModule ids if needed (#23031) 2018-03-28 09:15:16 -07:00
ng_module_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
parse_util.ts feat(compiler): implement "enableIvy" compiler option (#21427) 2018-01-18 18:22:44 -06:00
pipe_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
provider_analyzer.ts feat: change @Injectable() to support tree-shakeable tokens (#22005) 2018-02-12 14:34:59 -08:00
resource_loader.ts refactor(compiler): allow sync AOT compilation (#16832). 2017-05-23 10:41:23 -06:00
selector.ts refactor(ivy): align compiler with runtime (#22921) 2018-04-02 15:49:48 -07:00
shadow_css.ts fix(compiler): Don't strip `/*# sourceURL ... */` (#16088) 2018-01-24 12:35:30 -08:00
style_compiler.ts fix(compiler): various squashed fixes for the new ngc 2017-09-25 13:36:00 -07:00
style_url_resolver.ts fix(compiler): Don't strip CSS source maps 2017-08-15 16:30:09 -07:00
summary_resolver.ts fix(compiler): allow to use flat modules and summaries 2017-09-28 14:20:20 -07:00
url_resolver.ts refactor(compiler): split compiler and core (#18683) 2017-08-16 17:58:53 -05:00
util.ts Revert "fix(compiler): Pretty print object instead of [Object object] (#22689)" (#23442) 2018-04-19 14:51:58 -07:00
version.ts style: remove empty comments (#23404) 2018-05-10 15:48:13 -07:00