angular/packages
Kristiyan Kostadinov f6da091228 refactor(compiler): introduce compiler infrastructure for input transforms (#50225)
Adds the necessary compiler changes to support input transform functions. The compiler output has changed in the following ways:

### Directive handler
The directive handler now extracts a reference to the input transform function and it resolves the type of its first parameter. It also asserts that the type can be referenced in the compiled output and that it doesn't clash with any pre-existing `ngAcceptInputType_` members.

### .d.ts
In the generated declaration files the compiler now inserts an `ngAcceptInputType_` member for each input with a `transform` function. The member's type corresponds to the type of the first parameter of the function, e.g.

```typescript
// foo.directive.ts
@Directive()
export class Foo {
  @Input({transform: (incomingValue: string) => parseInt(incomingValue)}) value: number;
}

// foo.directive.d.ts
export class Foo {
  value: number;
  static ngAcceptInputType_value: string;
}
```

### Type check block
If an input has `transform` function, the TCB will use the type of its first parameter for the setter type. This uses the same infrastructure as the `ngAcceptInputType_` members.

### Directive declaration
The generated runtime directive declaration call now includes the `transform` function in the `inputs` map, if the input is being transformed. The function will be picked up by the runtime in the next commit to do the actual transformation.

```typescript
// foo.directive.ts
@Directive()
export class Foo {
  @Input({transform: (incomingValue: string) => parseInt(incomingValue)}) value: number;
}

// foo.directive.js
export class Foo {
  ɵdir = ɵɵdefineDirective({
    inputs: {
      value: ['value', 'value', incomingValue => parseInt(incomingValue)]
    }
  });
}
```

PR Close #50225
2023-05-22 14:48:02 +00:00
..
animations refactor: remove unnecessary array copying (#50370) 2023-05-22 14:47:29 +00:00
bazel build: update dependency @rollup/plugin-commonjs to v25 (#50264) 2023-05-12 10:15:11 -07:00
benchpress refactor(core): Remove ReflectiveInjector symbol (#48103) 2023-04-04 16:43:53 -07:00
common refactor(common): Reduce the precision to 2 digits in the ngOptimizedImage distortion warning message (#50276) 2023-05-16 09:23:15 -07:00
compiler refactor(compiler): introduce compiler infrastructure for input transforms (#50225) 2023-05-22 14:48:02 +00:00
compiler-cli refactor(compiler): introduce compiler infrastructure for input transforms (#50225) 2023-05-22 14:48:02 +00:00
core refactor(compiler): introduce compiler infrastructure for input transforms (#50225) 2023-05-22 14:48:02 +00:00
docs/di docs: remove outdated/unsupported webworker doc (#49856) 2023-04-17 14:01:41 +00:00
elements refactor(elements): remove unnecessary polyfill deps (#50115) 2023-05-10 14:32:36 -07:00
examples docs: ngComponentOutlet doc with projected template (#50173) 2023-05-19 16:35:48 +00:00
forms docs: added wiki link for domain model (#50180) 2023-05-17 08:12:21 -07:00
language-service feat(core): support TypeScript 5.1 (#50156) 2023-05-09 14:44:30 -07:00
localize docs(language-service): correction of the demonstration translation (#50359) 2023-05-19 14:20:29 +00:00
misc/angular-in-memory-web-api build: bump in-memory-web-api dependency versions (#50246) 2023-05-11 14:26:02 -07:00
platform-browser refactor(core): remove legacy way of preventing default actions (#50257) 2023-05-15 09:22:33 -07:00
platform-browser-dynamic refactor(platform-browser): cleanup references to dart (#49858) 2023-04-18 14:00:45 +00:00
platform-server refactor(core): simplify state transfer escaping (#50201) 2023-05-10 11:31:34 -07:00
private/testing fix(platform-server): bundle @angular/domino in via esbuild (#49229) 2023-02-28 13:34:50 -08:00
router refactor(router): remove private export of withPreloading (#50194) 2023-05-09 14:45:30 -07:00
service-worker build: update minimum supported Node version from 16.13.0 -> 16.14.0 (#49771) 2023-04-11 07:56:31 -07:00
upgrade build: update minimum supported Node version from 16.13.0 -> 16.14.0 (#49771) 2023-04-11 07:56:31 -07:00
zone.js build: update dependency google-closure-compiler to v20230502 (#50153) 2023-05-19 14:18:36 +00:00
BUILD.bazel build(bazel): list docs entrypoints under packages to simplify docgen 2022-11-22 13:51:16 -07:00
circular-deps-test.conf.js build: ignore type only imports/exports for circular dependency checks (#47017) 2022-08-18 12:06:09 -07:00
empty.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
goog.d.ts refactor(core): replace references to goog.LOCALE with goog.getLocale() (#43089) 2021-08-10 10:35:26 -07:00
license-banner.txt build: bump license year (#44590) 2022-01-04 12:05:25 -08:00
README.md
system.d.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
tsconfig-build.json build: update ts_library to produce ES2022 (#49559) 2023-03-23 08:18:45 -07:00
tsconfig-legacy-saucelabs.json refactor(compiler): drop obsolete NgFactory and NgSummary config options (#48268) 2023-02-21 13:03:59 -08:00
tsconfig-test.json build: switch devmode output to es2015 (#44505) 2022-01-05 23:20:20 +00:00
tsconfig-tsec-base.json build: update tsconfigs to use ES2020 as target and module (#43431) 2021-10-01 18:28:42 +00:00
tsconfig.json refactor(compiler): drop obsolete NgFactory and NgSummary config options (#48268) 2023-02-21 13:03:59 -08:00
tsec-exemption.json fix(core): hardening attribute and property binding rules for <iframe> elements (#47964) 2022-11-09 00:47:56 -08:00
types.d.ts build: update to jasmine 4.0 (#45558) 2022-04-11 16:25:28 +00:00

Angular

The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.

Usage information and reference details can be found in Angular documentation.

License: MIT