angular-cn/packages/compiler-cli/test
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
..
compliance fix(ivy): update compiler with latest runtime for view queries (#25061) 2018-07-25 10:39:30 -07:00
diagnostics build: upgrade jasmine (and related typings) to latest version (#19904) 2018-07-06 13:48:02 -07:00
metadata fix(compiler-cli): Use typescript to resolve modules for metadata (#22856) 2018-07-10 11:11:48 -07:00
ngtsc fix(ivy): force new imports for .d.ts files (#25080) 2018-07-26 16:38:09 -07:00
transformers build: upgrade jasmine (and related typings) to latest version (#19904) 2018-07-06 13:48:02 -07:00
BUILD.bazel test: switch to ts_web_test_suite (#23859) 2018-05-15 11:40:56 -07:00
extract_i18n_spec.ts fix(compiler): i18n_extractor now outputs the correct source file name (#24885) 2018-07-16 16:09:01 -04:00
mocks.ts fix(compiler-cli): Use typescript to resolve modules for metadata (#22856) 2018-07-10 11:11:48 -07:00
ngc_spec.ts build: upgrade jasmine (and related typings) to latest version (#19904) 2018-07-06 13:48:02 -07:00
ngtools_api_spec.ts ci(compiler-cli): run compiler-cli tests in bazel (#22997) 2018-03-28 10:02:53 -07:00
perform_watch_spec.ts build: upgrade to TypeScript 2.6 (#21144) 2017-12-22 20:15:47 -08:00
test_support.ts ci(compiler-cli): run compiler-cli tests in bazel (#22997) 2018-03-28 10:02:53 -07:00