angular/packages/compiler-cli/test/ngtsc
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
..
BUILD.bazel build: ensure bootstrap transitive runfiles are made available (#48521) 2022-12-19 19:50:41 +00:00
component_indexing_spec.ts refactor(compiler-cli): update to use new file-system interfaces (#40281) 2021-01-08 09:34:44 -08:00
env.ts refactor(compiler-cli): remove enableIvy options (#47346) 2022-09-06 11:33:48 -07:00
extended_template_diagnostics_spec.ts refactor(compiler-cli): remove leftover _extendedTemplateDiagnostics flag (#44920) 2022-02-01 18:24:10 +00:00
host_directives_spec.ts fix(core): host directives incorrectly validating aliased bindings (#50364) 2023-05-19 15:09:48 +00:00
imports_spec.ts refactor(compiler-cli): improve DX for reference emit failures (#44587) 2022-01-06 23:44:24 +00:00
incremental_error_spec.ts perf(compiler-cli): detect semantic changes and their effect on an incremental rebuild (#40947) 2021-03-08 08:41:19 -08:00
incremental_semantic_changes_spec.ts feat(compiler): add support for compile-time required inputs (#49468) 2023-03-20 13:10:30 +01:00
incremental_spec.ts perf(compiler-cli): optimize NgModule emit for standalone components (#49837) 2023-04-17 14:51:58 +00:00
incremental_typecheck_spec.ts refactor: make all imports compatible with ESM/CJS output. (#43431) 2021-10-01 18:28:45 +00:00
ls_typecheck_helpers_spec.ts fix(language-service): generate forwardRef for same file imports (#48898) 2023-02-02 13:40:17 -08:00
monorepo_spec.ts test(compiler-cli): move testing utils to separate package (#39594) 2020-11-17 11:59:56 -08:00
ngtsc_spec.ts refactor(compiler): introduce compiler infrastructure for input transforms (#50225) 2023-05-22 14:48:02 +00:00
scope_spec.ts feat(compiler-cli): standalone types imported into NgModule scopes (#44973) 2022-03-29 13:06:26 -07:00
sourcemap_utils.ts test: update source-map tests to account for source-map breaking change (#46888) 2022-07-19 09:40:54 -07:00
standalone_spec.ts refactor(compiler-cli): Add signals to internal directive metadata (#49981) 2023-04-25 15:39:18 -07:00
template_mapping_spec.ts test: update source-map tests to account for source-map breaking change (#46888) 2022-07-19 09:40:54 -07:00
template_typecheck_spec.ts refactor(compiler): introduce compiler infrastructure for input transforms (#50225) 2023-05-22 14:48:02 +00:00
util.ts refactor(compiler): Add a new helper method getPrimaryAngularDecorator. (#47180) 2022-08-22 10:39:42 -07:00
xi18n_spec.ts test(compiler): fix deprecation warning (#45285) 2022-03-07 11:36:47 -08:00