angular-cn/packages/compiler-cli/ngcc/test/host
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
..
commonjs_host_import_helper_spec.ts refactor(ngcc): use bundle src to create reflection hosts (#34254) 2019-12-18 11:25:01 -08:00
commonjs_host_spec.ts fix(ngcc): recognize re-exports with imported TS helpers in CommonJS and UMD (#34527) 2020-01-10 08:28:50 -08:00
esm5_host_import_helper_spec.ts refactor(ngcc): use bundle src to create reflection hosts (#34254) 2019-12-18 11:25:01 -08:00
esm5_host_spec.ts fix(ngcc): libraries using spread in object literals cannot be processed (#34661) 2020-01-23 10:29:57 -08:00
esm2015_host_import_helper_spec.ts refactor(ngcc): use bundle src to create reflection hosts (#34254) 2019-12-18 11:25:01 -08:00
esm2015_host_spec.ts fix(ngcc): correctly match aliased classes between src and dts files (#34254) 2019-12-18 11:25:01 -08:00
umd_host_import_helper_spec.ts refactor(ngcc): use bundle src to create reflection hosts (#34254) 2019-12-18 11:25:01 -08:00
umd_host_spec.ts fix(ngcc): recognize re-exports with imported TS helpers in CommonJS and UMD (#34527) 2020-01-10 08:28:50 -08:00
util.ts fix(ngcc): properly detect origin of constructor param types (#33901) 2019-11-19 11:38:33 -08:00