angular-cn/packages/compiler-cli/ngcc/test
Paul Gschwendtner 6b468f9b2e fix(ngcc): libraries using spread in object literals cannot be processed (#34661)
Consider a library that uses a shared constant for host bindings. e.g.

```ts
export const BASE_BINDINGS= {
  '[class.mat-themed]': '_isThemed',
}

----

@Directive({
  host: {...BASE_BINDINGS, '(click)': '...'}
})
export class Dir1 {}

@Directive({
  host: {...BASE_BINDINGS, '(click)': '...'}
})
export class Dir2 {}
```

Previously when these components were shipped as part of the
library to NPM, consumers were able to consume `Dir1` and `Dir2`.
No errors showed up.

Now with Ivy, when ngcc tries to process the library, an error
will be thrown. The error is stating that the host bindings should
be an object (which they obviously are). This happens because
TypeScript transforms the object spread to individual
`Object.assign` calls (for compatibility).

The partial evaluator used by the `@Directive` annotation handler
is unable to process this expression because there is no
integrated support for `Object.assign`. In View Engine, this was
not a problem because the `metadata.json` files from the library
were used to compute the host bindings.

Fixes #34659

PR Close #34661
2020-01-23 10:29:57 -08:00
..
analysis fix(ivy): don't run decorator handlers against declaration files (#34557) 2020-01-10 15:54:51 -08:00
dependencies test(ngcc): update dependency host test description (#34695) 2020-01-15 10:24:50 -08:00
entry_point_finder fix(ngcc): avoid error due to circular dependency in `EsmDependencyHost` (#34512) 2020-01-08 15:00:50 -08:00
execution fix(ngcc): update `package.json` deterministically (#34870) 2020-01-23 10:16:35 -08:00
helpers feat(ngcc): lock ngcc when processing (#34722) 2020-01-22 15:35:34 -08:00
host fix(ngcc): libraries using spread in object literals cannot be processed (#34661) 2020-01-23 10:29:57 -08:00
integration fix(ngcc): libraries using spread in object literals cannot be processed (#34661) 2020-01-23 10:29:57 -08:00
logging feat(compiler-cli): ngcc - make logging more configurable (#29591) 2019-04-01 11:53:28 -07:00
migrations feat(ivy): error in ivy when inheriting a ctor from an undecorated base (#34460) 2019-12-18 15:04:49 -08:00
packages test(ngcc): cleanup entry-point bundle testcases (#34415) 2019-12-16 07:45:36 -08:00
rendering fix(ngcc): insert definitions after statement (#34677) 2020-01-08 15:09:24 -08:00
writing fix(ngcc): update `package.json` deterministically (#34870) 2020-01-23 10:16:35 -08:00
BUILD.bazel test: handle bootstrap templated_args in jasmine_node_test defaults.bzl (#34736) 2020-01-15 14:58:07 -05:00
utils_spec.ts refactor(ngcc): use a special map for memoizing expensive-to-compute values (#34512) 2020-01-08 15:00:50 -08:00