diff --git a/.changeset/afraid-numbers-protect.md b/.changeset/afraid-numbers-protect.md new file mode 100644 index 0000000000..28dcacbcd7 --- /dev/null +++ b/.changeset/afraid-numbers-protect.md @@ -0,0 +1,5 @@ +--- +'@builder.io/mitosis': patch +--- + +Angular: fix: add typed argument `changes: SimpleChanges` to `ngOnChanges` lifecycle hook diff --git a/.changeset/ninety-lies-boil.md b/.changeset/ninety-lies-boil.md new file mode 100644 index 0000000000..af54f6fac9 --- /dev/null +++ b/.changeset/ninety-lies-boil.md @@ -0,0 +1,5 @@ +--- +'@builder.io/mitosis': patch +--- + +Angular: Fix: set initial value of `inputs` for `*ngComponentOutlet`to`{}`instead of`null`. diff --git a/packages/core/src/__tests__/__snapshots__/angular.import.test.ts.snap b/packages/core/src/__tests__/__snapshots__/angular.import.test.ts.snap index 5b2494cd48..732a832539 100644 --- a/packages/core/src/__tests__/__snapshots__/angular.import.test.ts.snap +++ b/packages/core/src/__tests__/__snapshots__/angular.import.test.ts.snap @@ -57,7 +57,7 @@ export default class MyBasicRefComponent { return this.name.toLowerCase(); }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Received an update\\"); } @@ -684,7 +684,7 @@ export default class MyPreviousComponent { private _prevCount = this.count; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this._prevCount = this.count; } @@ -2354,7 +2354,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -2522,7 +2522,7 @@ import { Component } from \\"@angular/core\\"; export default class MyBasicOnUpdateReturnComponent { name = \\"PatrickJS\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { const controller = new AbortController(); const signal = controller.signal; @@ -3058,7 +3058,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -3290,7 +3290,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class MultipleOnUpdate { - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); console.log(\\"Runs on every update/rerender as well\\"); @@ -3332,7 +3332,7 @@ export default class MultipleOnUpdateWithDeps { c = \\"c\\"; d = \\"d\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs when this.a or this.b changes\\", this.a, this.b); @@ -3756,7 +3756,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class OnUpdate { - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); } @@ -3797,7 +3797,7 @@ export default class OnUpdateWithDeps { a = \\"a\\"; b = \\"b\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log( \\"Runs when this.a, this.b or size changes\\", @@ -4055,7 +4055,7 @@ export default class OnUpdate { }; }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.foo({ someOption: this.bar, @@ -4082,7 +4082,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -4417,7 +4417,7 @@ export default class RenderContent { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { dispatchNewContentToVisualEditor(this.content); } @@ -4804,7 +4804,7 @@ export default class MyBasicComponent { @Input() id; @Input() foo; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"props.id changed\\", this.id); console.log(\\"props.foo.value.bar.baz changed\\", this.foo.value.bar.baz); @@ -5486,7 +5486,13 @@ exports[`Angular with Preserve Imports and File Extensions > jsx > Typescript Te "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, ViewChild, ElementRef, Input } from \\"@angular/core\\"; +import { + Component, + ViewChild, + ElementRef, + Input, + SimpleChanges, +} from \\"@angular/core\\"; export interface Props { showInput: boolean; @@ -5543,7 +5549,7 @@ export default class MyBasicRefComponent { return this.name.toLowerCase(); }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Received an update\\"); } @@ -6156,7 +6162,7 @@ exports[`Angular with Preserve Imports and File Extensions > jsx > Typescript Te "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; export interface Props { showInput: boolean; @@ -6196,7 +6202,7 @@ export default class MyPreviousComponent { private _prevCount = this.count; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this._prevCount = this.count; } @@ -8084,7 +8090,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -8245,7 +8251,7 @@ exports[`Angular with Preserve Imports and File Extensions > jsx > Typescript Te "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: @@ -8264,7 +8270,7 @@ import { Component } from \\"@angular/core\\"; export default class MyBasicOnUpdateReturnComponent { name = \\"PatrickJS\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { const controller = new AbortController(); const signal = controller.signal; @@ -8837,7 +8843,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -9065,7 +9071,7 @@ exports[`Angular with Preserve Imports and File Extensions > jsx > Typescript Te "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"multiple-on-update, MultipleOnUpdate\\", @@ -9081,7 +9087,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class MultipleOnUpdate { - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); console.log(\\"Runs on every update/rerender as well\\"); @@ -9102,7 +9108,7 @@ exports[`Angular with Preserve Imports and File Extensions > jsx > Typescript Te "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"multiple-on-update-with-deps, MultipleOnUpdateWithDeps\\", @@ -9123,7 +9129,7 @@ export default class MultipleOnUpdateWithDeps { c = \\"c\\"; d = \\"d\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs when this.a or this.b changes\\", this.a, this.b); @@ -9540,7 +9546,7 @@ exports[`Angular with Preserve Imports and File Extensions > jsx > Typescript Te "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"on-update, OnUpdate\\", @@ -9556,7 +9562,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class OnUpdate { - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); } @@ -9576,7 +9582,7 @@ exports[`Angular with Preserve Imports and File Extensions > jsx > Typescript Te "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { size: string; @@ -9601,7 +9607,7 @@ export default class OnUpdateWithDeps { a = \\"a\\"; b = \\"b\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log( \\"Runs when this.a, this.b or size changes\\", @@ -9873,7 +9879,7 @@ exports[`Angular with Preserve Imports and File Extensions > jsx > Typescript Te "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"on-update, OnUpdate\\", @@ -9897,7 +9903,7 @@ export default class OnUpdate { }; }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.foo({ someOption: this.bar, @@ -9924,7 +9930,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -10231,7 +10237,7 @@ exports[`Angular with Preserve Imports and File Extensions > jsx > Typescript Te "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { customComponents: string[]; @@ -10280,7 +10286,7 @@ export default class RenderContent { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { dispatchNewContentToVisualEditor(this.content); } @@ -10674,7 +10680,7 @@ exports[`Angular with Preserve Imports and File Extensions > jsx > Typescript Te "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { id: string; @@ -10705,7 +10711,7 @@ export default class MyBasicComponent { @Input() id!: Props[\\"id\\"]; @Input() foo!: Props[\\"foo\\"]; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"props.id changed\\", this.id); console.log(\\"props.foo.value.bar.baz changed\\", this.foo.bar.baz); @@ -11789,7 +11795,7 @@ export default class MyComponent { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"onAfterUpdate\\"); } @@ -11880,7 +11886,7 @@ export default class MyComponent { this.result = a_ * b_; }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.calculateResult(this.a, this.b); } @@ -12413,7 +12419,7 @@ exports[`Angular with Preserve Imports and File Extensions > svelte > Typescript "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"my-component, MyComponent\\", @@ -12435,7 +12441,7 @@ export default class MyComponent { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"onAfterUpdate\\"); } @@ -12498,7 +12504,7 @@ exports[`Angular with Preserve Imports and File Extensions > svelte > Typescript "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"my-component, MyComponent\\", @@ -12526,7 +12532,7 @@ export default class MyComponent { this.result = a_ * b_; }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.calculateResult(this.a, this.b); } diff --git a/packages/core/src/__tests__/__snapshots__/angular.mapper.test.ts.snap b/packages/core/src/__tests__/__snapshots__/angular.mapper.test.ts.snap index 5ce9524da9..a0cd2f5a97 100644 --- a/packages/core/src/__tests__/__snapshots__/angular.mapper.test.ts.snap +++ b/packages/core/src/__tests__/__snapshots__/angular.mapper.test.ts.snap @@ -57,7 +57,7 @@ export default class MyBasicRefComponent { return this.name.toLowerCase(); }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Received an update\\"); } @@ -697,7 +697,7 @@ export default class MyPreviousComponent { private _prevCount = this.count; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this._prevCount = this.count; } @@ -2394,7 +2394,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -2565,7 +2565,7 @@ import { Component } from \\"@angular/core\\"; export default class MyBasicOnUpdateReturnComponent { name = \\"PatrickJS\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { const controller = new AbortController(); const signal = controller.signal; @@ -3114,7 +3114,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -3351,7 +3351,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class MultipleOnUpdate { - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); console.log(\\"Runs on every update/rerender as well\\"); @@ -3394,7 +3394,7 @@ export default class MultipleOnUpdateWithDeps { c = \\"c\\"; d = \\"d\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs when this.a or this.b changes\\", this.a, this.b); @@ -3828,7 +3828,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class OnUpdate { - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); } @@ -3870,7 +3870,7 @@ export default class OnUpdateWithDeps { a = \\"a\\"; b = \\"b\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log( \\"Runs when this.a, this.b or size changes\\", @@ -4135,7 +4135,7 @@ export default class OnUpdate { }; }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.foo({ someOption: this.bar, @@ -4163,7 +4163,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -4499,7 +4499,7 @@ export default class RenderContent { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { dispatchNewContentToVisualEditor(this.content); } @@ -4895,7 +4895,7 @@ export default class MyBasicComponent { @Input() id; @Input() foo; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"props.id changed\\", this.id); console.log(\\"props.foo.value.bar.baz changed\\", this.foo.value.bar.baz); @@ -5595,7 +5595,13 @@ exports[`Angular with Import Mapper Tests > jsx > Typescript Test > AdvancedRef "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, ViewChild, ElementRef, Input } from \\"@angular/core\\"; +import { + Component, + ViewChild, + ElementRef, + Input, + SimpleChanges, +} from \\"@angular/core\\"; export interface Props { showInput: boolean; @@ -5652,7 +5658,7 @@ export default class MyBasicRefComponent { return this.name.toLowerCase(); }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Received an update\\"); } @@ -6278,7 +6284,7 @@ exports[`Angular with Import Mapper Tests > jsx > Typescript Test > BasicRefPrev "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; export interface Props { showInput: boolean; @@ -6318,7 +6324,7 @@ export default class MyPreviousComponent { private _prevCount = this.count; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this._prevCount = this.count; } @@ -8233,7 +8239,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -8397,7 +8403,7 @@ exports[`Angular with Import Mapper Tests > jsx > Typescript Test > basicOnUpdat "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: @@ -8416,7 +8422,7 @@ import { Component } from \\"@angular/core\\"; export default class MyBasicOnUpdateReturnComponent { name = \\"PatrickJS\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { const controller = new AbortController(); const signal = controller.signal; @@ -9002,7 +9008,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -9237,7 +9243,7 @@ exports[`Angular with Import Mapper Tests > jsx > Typescript Test > multipleOnUp "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"multiple-on-update, MultipleOnUpdate\\", @@ -9253,7 +9259,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class MultipleOnUpdate { - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); console.log(\\"Runs on every update/rerender as well\\"); @@ -9275,7 +9281,7 @@ exports[`Angular with Import Mapper Tests > jsx > Typescript Test > multipleOnUp "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"multiple-on-update-with-deps, MultipleOnUpdateWithDeps\\", @@ -9296,7 +9302,7 @@ export default class MultipleOnUpdateWithDeps { c = \\"c\\"; d = \\"d\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs when this.a or this.b changes\\", this.a, this.b); @@ -9723,7 +9729,7 @@ exports[`Angular with Import Mapper Tests > jsx > Typescript Test > onUpdate 1`] "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"on-update, OnUpdate\\", @@ -9739,7 +9745,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class OnUpdate { - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); } @@ -9760,7 +9766,7 @@ exports[`Angular with Import Mapper Tests > jsx > Typescript Test > onUpdateWith "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { size: string; @@ -9785,7 +9791,7 @@ export default class OnUpdateWithDeps { a = \\"a\\"; b = \\"b\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log( \\"Runs when this.a, this.b or size changes\\", @@ -10064,7 +10070,7 @@ exports[`Angular with Import Mapper Tests > jsx > Typescript Test > referencingF "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"on-update, OnUpdate\\", @@ -10088,7 +10094,7 @@ export default class OnUpdate { }; }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.foo({ someOption: this.bar, @@ -10116,7 +10122,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -10424,7 +10430,7 @@ exports[`Angular with Import Mapper Tests > jsx > Typescript Test > renderConten "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { customComponents: string[]; @@ -10473,7 +10479,7 @@ export default class RenderContent { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { dispatchNewContentToVisualEditor(this.content); } @@ -10876,7 +10882,7 @@ exports[`Angular with Import Mapper Tests > jsx > Typescript Test > signalsOnUpd "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { id: string; @@ -10907,7 +10913,7 @@ export default class MyBasicComponent { @Input() id!: Props[\\"id\\"]; @Input() foo!: Props[\\"foo\\"]; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"props.id changed\\", this.id); console.log(\\"props.foo.value.bar.baz changed\\", this.foo.bar.baz); @@ -12018,7 +12024,7 @@ export default class MyComponent { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"onAfterUpdate\\"); } @@ -12111,7 +12117,7 @@ export default class MyComponent { this.result = a_ * b_; }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.calculateResult(this.a, this.b); } @@ -12658,7 +12664,7 @@ exports[`Angular with Import Mapper Tests > svelte > Typescript Test > lifecycle "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"my-component, MyComponent\\", @@ -12680,7 +12686,7 @@ export default class MyComponent { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"onAfterUpdate\\"); } @@ -12745,7 +12751,7 @@ exports[`Angular with Import Mapper Tests > svelte > Typescript Test > reactiveW "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"my-component, MyComponent\\", @@ -12773,7 +12779,7 @@ export default class MyComponent { this.result = a_ * b_; }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.calculateResult(this.a, this.b); } diff --git a/packages/core/src/__tests__/__snapshots__/angular.state.test.ts.snap b/packages/core/src/__tests__/__snapshots__/angular.state.test.ts.snap index b184dca910..da2bf9de32 100644 --- a/packages/core/src/__tests__/__snapshots__/angular.state.test.ts.snap +++ b/packages/core/src/__tests__/__snapshots__/angular.state.test.ts.snap @@ -62,7 +62,7 @@ export default class MyBasicRefComponent { this.node_1_div = this.lowerCaseName(); } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Received an update\\"); this.node_1_div = this.lowerCaseName(); @@ -224,7 +224,7 @@ export default class MyBasicComponent { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_div = this.myService.method(\\"hello\\") + this.name; } @@ -612,7 +612,7 @@ export default class MyBasicRefComponent { this.node_1_div = this.lowerCaseName(); } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_1_div = this.lowerCaseName(); } @@ -706,7 +706,7 @@ export default class MyPreviousComponent { private _prevCount = this.count; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this._prevCount = this.count; } @@ -1020,7 +1020,7 @@ export default class CustomCode { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_div = \\"builder-custom-code\\" + (this.replaceNodes ? \\" replace-nodes\\" : \\"\\"); @@ -1116,7 +1116,7 @@ export default class CustomCode { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_div = \\"builder-custom-code\\" + (this.replaceNodes ? \\" replace-nodes\\" : \\"\\"); @@ -1457,7 +1457,7 @@ export default class FormComponent { this.node_1_div = JSON.stringify(this.responseData, null, 2); } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_1_div = JSON.stringify(this.responseData, null, 2); } @@ -1572,7 +1572,7 @@ export default class Image { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_Show = !this.useLazyLoading() || this.load; this.node_1_img = @@ -1677,7 +1677,7 @@ export default class ImgComponent { }; } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_img = { objectFit: this.backgroundSize || \\"cover\\", @@ -1858,7 +1858,7 @@ export default class SectionComponent { : undefined; } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_section = this.maxWidth && typeof this.maxWidth === \\"number\\" @@ -2295,7 +2295,7 @@ export default class Text { }; } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_div = { test: this.name || \\"any name\\", @@ -2409,7 +2409,7 @@ export default class Video { }; } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_video = { width: \\"100%\\", @@ -2481,7 +2481,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -2522,7 +2522,7 @@ export default class MyBasicForNoTagRefComponent { get TagNameGetter() { return \\"span\\"; } - mergedInputs_0 = null; + mergedInputs_0 = {}; constructor(private vcRef) {} @@ -2537,7 +2537,7 @@ export default class MyBasicForNoTagRefComponent { ]; } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.mergedInputs_0 = {}; } @@ -2658,7 +2658,7 @@ import { Component } from \\"@angular/core\\"; export default class MyBasicOnUpdateReturnComponent { name = \\"PatrickJS\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { const controller = new AbortController(); const signal = controller.signal; @@ -3182,7 +3182,7 @@ export default class MyComponent { onClick = function onClick() { console.log(\\"hello\\"); }; - mergedInputs_mlw9p4 = null; + mergedInputs_mlw9p4 = {}; ngOnInit() { this.mergedInputs_mlw9p4 = { @@ -3193,7 +3193,7 @@ export default class MyComponent { }; } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.mergedInputs_mlw9p4 = { hello: \\"world\\", @@ -3223,7 +3223,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -3259,7 +3259,7 @@ export default class MyComponent { onClick = function onClick(event) { console.log(\\"hello\\", event); }; - mergedInputs_mlw9p4 = null; + mergedInputs_mlw9p4 = {}; constructor(private vcRef) {} @@ -3276,7 +3276,7 @@ export default class MyComponent { ]; } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.mergedInputs_mlw9p4 = { hello: \\"world\\", @@ -3378,7 +3378,7 @@ export default class Button { this.node_0_div = this.baz(1); } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_div = this.baz(1); } @@ -3432,7 +3432,7 @@ export default class RenderContent { }; } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_RenderBlock = { ...this.getRenderContentProps(this.renderContentProps.block, 0), @@ -3500,7 +3500,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class MultipleOnUpdate { - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); console.log(\\"Runs on every update/rerender as well\\"); @@ -3542,7 +3542,7 @@ export default class MultipleOnUpdateWithDeps { c = \\"c\\"; d = \\"d\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs when this.a or this.b changes\\", this.a, this.b); @@ -3966,7 +3966,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class OnUpdate { - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); } @@ -4007,7 +4007,7 @@ export default class OnUpdateWithDeps { a = \\"a\\"; b = \\"b\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log( \\"Runs when this.a, this.b or size changes\\", @@ -4265,7 +4265,7 @@ export default class OnUpdate { }; }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.foo({ someOption: this.bar, @@ -4292,7 +4292,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -4544,11 +4544,11 @@ export default class RenderBlock { node_0_Show = null; node_1_Show = null; node_2_Show = null; - mergedInputs_3ka5tf = null; + mergedInputs_3ka5tf = {}; trackByData0(index, data) { return index; } - mergedInputs_r2fkt2 = null; + mergedInputs_r2fkt2 = {}; trackByChild1(_, child) { return \\"render-block-\\" + child.id; } @@ -4573,7 +4573,7 @@ export default class RenderBlock { ]; } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_Show = isEmptyHtmlElement(this.tag); this.node_1_Show = !isEmptyHtmlElement(this.tag) && this.repeatItemData; @@ -4641,7 +4641,7 @@ export default class RenderContent { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { dispatchNewContentToVisualEditor(this.content); } @@ -5031,7 +5031,7 @@ export default class MyBasicComponent { @Input() id; @Input() foo; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"props.id changed\\", this.id); console.log(\\"props.foo.value.bar.baz changed\\", this.foo.value.bar.baz); @@ -5226,7 +5226,7 @@ export default class MyComponent { this.node_0_Comp = { ...this.val }; } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_Comp = { ...this.val }; } @@ -5275,7 +5275,7 @@ export default class MyComponent { }; } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_div = { width: \\"100%\\", @@ -5716,7 +5716,13 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, ViewChild, ElementRef, Input } from \\"@angular/core\\"; +import { + Component, + ViewChild, + ElementRef, + Input, + SimpleChanges, +} from \\"@angular/core\\"; export interface Props { showInput: boolean; @@ -5778,7 +5784,7 @@ export default class MyBasicRefComponent { this.node_1_div = this.lowerCaseName(); } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Received an update\\"); this.node_1_div = this.lowerCaseName(); @@ -5902,7 +5908,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; import { Injector, MyService, createInjector } from \\"@dummy/injection-js\\"; @@ -5944,7 +5950,7 @@ export default class MyBasicComponent { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_div = this.myService.method(\\"hello\\") + this.name; } @@ -6284,7 +6290,13 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, ViewChild, ElementRef, Input } from \\"@angular/core\\"; +import { + Component, + ViewChild, + ElementRef, + Input, + SimpleChanges, +} from \\"@angular/core\\"; export interface Props { showInput: boolean; @@ -6346,7 +6358,7 @@ export default class MyBasicRefComponent { this.node_1_div = this.lowerCaseName(); } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_1_div = this.lowerCaseName(); } @@ -6408,7 +6420,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; export interface Props { showInput: boolean; @@ -6448,7 +6460,7 @@ export default class MyPreviousComponent { private _prevCount = this.count; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this._prevCount = this.count; } @@ -6721,7 +6733,13 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, ViewChild, ElementRef, Input } from \\"@angular/core\\"; +import { + Component, + ViewChild, + ElementRef, + Input, + SimpleChanges, +} from \\"@angular/core\\"; export interface CustomCodeProps { code: string; @@ -6801,7 +6819,7 @@ export default class CustomCode { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_div = \\"builder-custom-code\\" + (this.replaceNodes ? \\" replace-nodes\\" : \\"\\"); @@ -6822,7 +6840,13 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, ViewChild, ElementRef, Input } from \\"@angular/core\\"; +import { + Component, + ViewChild, + ElementRef, + Input, + SimpleChanges, +} from \\"@angular/core\\"; export interface CustomCodeProps { code: string; @@ -6902,7 +6926,7 @@ export default class CustomCode { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_div = \\"builder-custom-code\\" + (this.replaceNodes ? \\" replace-nodes\\" : \\"\\"); @@ -6923,7 +6947,13 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, ViewChild, ElementRef, Input } from \\"@angular/core\\"; +import { + Component, + ViewChild, + ElementRef, + Input, + SimpleChanges, +} from \\"@angular/core\\"; export interface FormProps { attributes?: any; @@ -7274,7 +7304,7 @@ export default class FormComponent { this.node_1_div = JSON.stringify(this.responseData, null, 2); } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_1_div = JSON.stringify(this.responseData, null, 2); } @@ -7294,7 +7324,13 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, ViewChild, ElementRef, Input } from \\"@angular/core\\"; +import { + Component, + ViewChild, + ElementRef, + Input, + SimpleChanges, +} from \\"@angular/core\\"; // TODO: AMP Support? export interface ImageProps { @@ -7408,7 +7444,7 @@ export default class Image { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_Show = !this.useLazyLoading() || this.load; this.node_1_img = @@ -7475,7 +7511,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; export interface ImgProps { attributes?: any; @@ -7530,7 +7566,7 @@ export default class ImgComponent { }; } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_img = { objectFit: this.backgroundSize || \\"cover\\", @@ -7695,7 +7731,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; export interface SectionProps { maxWidth?: number; @@ -7733,7 +7769,7 @@ export default class SectionComponent { : undefined; } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_section = this.maxWidth && typeof this.maxWidth === \\"number\\" @@ -8179,7 +8215,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; export interface TextProps { attributes?: any; @@ -8221,7 +8257,7 @@ export default class Text { }; } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_div = { test: this.name || \\"any name\\", @@ -8293,7 +8329,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; export interface VideoProps { attributes?: any; @@ -8369,7 +8405,7 @@ export default class Video { }; } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_video = { width: \\"100%\\", @@ -8441,8 +8477,9 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, + SimpleChanges, } from \\"@angular/core\\"; @Component({ @@ -8484,7 +8521,7 @@ export default class MyBasicForNoTagRefComponent { get TagNameGetter() { return \\"span\\"; } - mergedInputs_0 = null; + mergedInputs_0 = {} as any; constructor(private vcRef: ViewContainerRef) {} @@ -8499,7 +8536,7 @@ export default class MyBasicForNoTagRefComponent { ]; } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.mergedInputs_0 = {}; } @@ -8611,7 +8648,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: @@ -8630,7 +8667,7 @@ import { Component } from \\"@angular/core\\"; export default class MyBasicOnUpdateReturnComponent { name = \\"PatrickJS\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { const controller = new AbortController(); const signal = controller.signal; @@ -9159,7 +9196,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"my-component, MyComponent\\", @@ -9191,7 +9228,7 @@ export default class MyComponent { onClick = function onClick() { console.log(\\"hello\\"); }; - mergedInputs_mlw9p4 = null; + mergedInputs_mlw9p4 = {} as any; ngOnInit() { this.mergedInputs_mlw9p4 = { @@ -9202,7 +9239,7 @@ export default class MyComponent { }; } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.mergedInputs_mlw9p4 = { hello: \\"world\\", @@ -9232,8 +9269,9 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, + SimpleChanges, } from \\"@angular/core\\"; @Component({ @@ -9269,7 +9307,7 @@ export default class MyComponent { onClick = function onClick(event: any) { console.log(\\"hello\\", event); }; - mergedInputs_mlw9p4 = null; + mergedInputs_mlw9p4 = {} as any; constructor(private vcRef: ViewContainerRef) {} @@ -9286,7 +9324,7 @@ export default class MyComponent { ]; } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.mergedInputs_mlw9p4 = { hello: \\"world\\", @@ -9351,7 +9389,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; export interface ButtonProps { foo: string; @@ -9392,7 +9430,7 @@ export default class Button { this.node_0_div = this.baz(1); } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_div = this.baz(1); } @@ -9412,7 +9450,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type RenderContentProps = { options?: GetContentOptions; @@ -9453,7 +9491,7 @@ export default class RenderContent { }; } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_RenderBlock = { ...this.getRenderContentProps(this.renderContentProps.block, 0), @@ -9505,7 +9543,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"multiple-on-update, MultipleOnUpdate\\", @@ -9521,7 +9559,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class MultipleOnUpdate { - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); console.log(\\"Runs on every update/rerender as well\\"); @@ -9542,7 +9580,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"multiple-on-update-with-deps, MultipleOnUpdateWithDeps\\", @@ -9563,7 +9601,7 @@ export default class MultipleOnUpdateWithDeps { c = \\"c\\"; d = \\"d\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs when this.a or this.b changes\\", this.a, this.b); @@ -9980,7 +10018,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"on-update, OnUpdate\\", @@ -9996,7 +10034,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class OnUpdate { - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); } @@ -10016,7 +10054,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { size: string; @@ -10041,7 +10079,7 @@ export default class OnUpdateWithDeps { a = \\"a\\"; b = \\"b\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log( \\"Runs when this.a, this.b or size changes\\", @@ -10313,7 +10351,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"on-update, OnUpdate\\", @@ -10337,7 +10375,7 @@ export default class OnUpdate { }; }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.foo({ someOption: this.bar, @@ -10364,8 +10402,9 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, + SimpleChanges, } from \\"@angular/core\\"; export type RenderBlockProps = { @@ -10628,11 +10667,11 @@ export default class RenderBlock { node_0_Show = null; node_1_Show = null; node_2_Show = null; - mergedInputs_3ka5tf = null; + mergedInputs_3ka5tf = {} as any; trackByData0(index, data) { return index; } - mergedInputs_r2fkt2 = null; + mergedInputs_r2fkt2 = {} as any; trackByChild1(_, child) { return \\"render-block-\\" + child.id; } @@ -10657,7 +10696,7 @@ export default class RenderBlock { ]; } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_Show = isEmptyHtmlElement(this.tag); this.node_1_Show = !isEmptyHtmlElement(this.tag) && this.repeatItemData; @@ -10686,7 +10725,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { customComponents: string[]; @@ -10733,7 +10772,7 @@ export default class RenderContent { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { dispatchNewContentToVisualEditor(this.content); } @@ -11130,7 +11169,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { id: string; @@ -11161,7 +11200,7 @@ export default class MyBasicComponent { @Input() id!: Props[\\"id\\"]; @Input() foo!: Props[\\"foo\\"]; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"props.id changed\\", this.id); console.log(\\"props.foo.value.bar.baz changed\\", this.foo.bar.baz); @@ -11330,7 +11369,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"my-component, MyComponent\\", @@ -11356,7 +11395,7 @@ export default class MyComponent { this.node_0_Comp = { ...this.val }; } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_Comp = { ...this.val }; } @@ -11376,7 +11415,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"my-component, MyComponent\\", @@ -11405,7 +11444,7 @@ export default class MyComponent { }; } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_div = { width: \\"100%\\", @@ -11929,7 +11968,7 @@ export default class MyComponent { this.node_0_input = this.fillings === \\"Guac (extra)\\"; } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_input = this.fillings === \\"Guac (extra)\\"; } @@ -12010,7 +12049,7 @@ export default class MyComponent { }\`; } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.node_0_input = \`form-input \${this.disabled ? \\"disabled\\" : \\"\\"} \${ this.focus ? \\"focus\\" : \\"\\" @@ -12270,7 +12309,7 @@ export default class MyComponent { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"onAfterUpdate\\"); } @@ -12361,7 +12400,7 @@ export default class MyComponent { this.result = a_ * b_; }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.calculateResult(this.a, this.b); } @@ -12526,7 +12565,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"my-component, MyComponent\\", @@ -12598,7 +12637,7 @@ export default class MyComponent { this.node_0_input = this.fillings === \\"Guac (extra)\\"; } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_input = this.fillings === \\"Guac (extra)\\"; } @@ -12650,7 +12689,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; const defaultProps = {}; @@ -12679,7 +12718,7 @@ export default class MyComponent { }\`; } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.node_0_input = \`form-input \${this.disabled ? \\"disabled\\" : \\"\\"} \${ this.focus ? \\"focus\\" : \\"\\" @@ -12917,7 +12956,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"my-component, MyComponent\\", @@ -12939,7 +12978,7 @@ export default class MyComponent { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"onAfterUpdate\\"); } @@ -13002,7 +13041,7 @@ exports[`Angular with manually creating and handling class properties as binding "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"my-component, MyComponent\\", @@ -13030,7 +13069,7 @@ export default class MyComponent { this.result = a_ * b_; }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.calculateResult(this.a, this.b); } diff --git a/packages/core/src/__tests__/__snapshots__/angular.styles.test.ts.snap b/packages/core/src/__tests__/__snapshots__/angular.styles.test.ts.snap index 0bffabc64d..5559e56a97 100644 --- a/packages/core/src/__tests__/__snapshots__/angular.styles.test.ts.snap +++ b/packages/core/src/__tests__/__snapshots__/angular.styles.test.ts.snap @@ -54,7 +54,7 @@ export default class MyBasicRefComponent { return this.name.toLowerCase(); }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Received an update\\"); } @@ -598,7 +598,7 @@ export default class MyPreviousComponent { private _prevCount = this.count; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this._prevCount = this.count; } @@ -2102,7 +2102,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -2250,7 +2250,7 @@ import { Component } from \\"@angular/core\\"; export default class MyBasicOnUpdateReturnComponent { name = \\"PatrickJS\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { const controller = new AbortController(); const signal = controller.signal; @@ -2716,7 +2716,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -2906,7 +2906,7 @@ import { Component } from \\"@angular/core\\"; \`, }) export default class MultipleOnUpdate { - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); console.log(\\"Runs on every update/rerender as well\\"); @@ -2941,7 +2941,7 @@ export default class MultipleOnUpdateWithDeps { c = \\"c\\"; d = \\"d\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs when this.a or this.b changes\\", this.a, this.b); @@ -3299,7 +3299,7 @@ import { Component } from \\"@angular/core\\"; \`, }) export default class OnUpdate { - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); } @@ -3333,7 +3333,7 @@ export default class OnUpdateWithDeps { a = \\"a\\"; b = \\"b\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log( \\"Runs when this.a, this.b or size changes\\", @@ -3542,7 +3542,7 @@ export default class OnUpdate { }; }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.foo({ someOption: this.bar, @@ -3569,7 +3569,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -3888,7 +3888,7 @@ export default class RenderContent { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { dispatchNewContentToVisualEditor(this.content); } @@ -4216,7 +4216,7 @@ export default class MyBasicComponent { @Input() id; @Input() foo; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"props.id changed\\", this.id); console.log(\\"props.foo.value.bar.baz changed\\", this.foo.value.bar.baz); @@ -4797,7 +4797,13 @@ exports[`Angular with visuallyIgnoreHostElement = false > jsx > Typescript Test "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, ViewChild, ElementRef, Input } from \\"@angular/core\\"; +import { + Component, + ViewChild, + ElementRef, + Input, + SimpleChanges, +} from \\"@angular/core\\"; export interface Props { showInput: boolean; @@ -4851,7 +4857,7 @@ export default class MyBasicRefComponent { return this.name.toLowerCase(); }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Received an update\\"); } @@ -5388,7 +5394,7 @@ exports[`Angular with visuallyIgnoreHostElement = false > jsx > Typescript Test "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; export interface Props { showInput: boolean; @@ -5421,7 +5427,7 @@ export default class MyPreviousComponent { private _prevCount = this.count; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this._prevCount = this.count; } @@ -7143,7 +7149,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -7291,7 +7297,7 @@ exports[`Angular with visuallyIgnoreHostElement = false > jsx > Typescript Test "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: @@ -7303,7 +7309,7 @@ import { Component } from \\"@angular/core\\"; export default class MyBasicOnUpdateReturnComponent { name = \\"PatrickJS\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { const controller = new AbortController(); const signal = controller.signal; @@ -7806,7 +7812,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -7999,7 +8005,7 @@ exports[`Angular with visuallyIgnoreHostElement = false > jsx > Typescript Test "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"multiple-on-update, MultipleOnUpdate\\", @@ -8008,7 +8014,7 @@ import { Component } from \\"@angular/core\\"; \`, }) export default class MultipleOnUpdate { - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); console.log(\\"Runs on every update/rerender as well\\"); @@ -8029,7 +8035,7 @@ exports[`Angular with visuallyIgnoreHostElement = false > jsx > Typescript Test "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"multiple-on-update-with-deps, MultipleOnUpdateWithDeps\\", @@ -8043,7 +8049,7 @@ export default class MultipleOnUpdateWithDeps { c = \\"c\\"; d = \\"d\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs when this.a or this.b changes\\", this.a, this.b); @@ -8401,7 +8407,7 @@ exports[`Angular with visuallyIgnoreHostElement = false > jsx > Typescript Test "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"on-update, OnUpdate\\", @@ -8410,7 +8416,7 @@ import { Component } from \\"@angular/core\\"; \`, }) export default class OnUpdate { - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); } @@ -8430,7 +8436,7 @@ exports[`Angular with visuallyIgnoreHostElement = false > jsx > Typescript Test "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { size: string; @@ -8448,7 +8454,7 @@ export default class OnUpdateWithDeps { a = \\"a\\"; b = \\"b\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log( \\"Runs when this.a, this.b or size changes\\", @@ -8678,7 +8684,7 @@ exports[`Angular with visuallyIgnoreHostElement = false > jsx > Typescript Test "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"on-update, OnUpdate\\", @@ -8695,7 +8701,7 @@ export default class OnUpdate { }; }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.foo({ someOption: this.bar, @@ -8722,7 +8728,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -9017,7 +9023,7 @@ exports[`Angular with visuallyIgnoreHostElement = false > jsx > Typescript Test "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { customComponents: string[]; @@ -9061,7 +9067,7 @@ export default class RenderContent { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { dispatchNewContentToVisualEditor(this.content); } @@ -9399,7 +9405,7 @@ exports[`Angular with visuallyIgnoreHostElement = false > jsx > Typescript Test "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { id: string; @@ -9427,7 +9433,7 @@ export default class MyBasicComponent { @Input() id!: Props[\\"id\\"]; @Input() foo!: Props[\\"foo\\"]; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"props.id changed\\", this.id); console.log(\\"props.foo.value.bar.baz changed\\", this.foo.bar.baz); @@ -10337,7 +10343,7 @@ export default class MyComponent { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"onAfterUpdate\\"); } @@ -10414,7 +10420,7 @@ export default class MyComponent { this.result = a_ * b_; }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.calculateResult(this.a, this.b); } @@ -10858,7 +10864,7 @@ exports[`Angular with visuallyIgnoreHostElement = false > svelte > Typescript Te "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"my-component, MyComponent\\", @@ -10873,7 +10879,7 @@ export default class MyComponent { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"onAfterUpdate\\"); } @@ -10929,7 +10935,7 @@ exports[`Angular with visuallyIgnoreHostElement = false > svelte > Typescript Te "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"my-component, MyComponent\\", @@ -10950,7 +10956,7 @@ export default class MyComponent { this.result = a_ * b_; }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.calculateResult(this.a, this.b); } diff --git a/packages/core/src/__tests__/__snapshots__/angular.test.ts.snap b/packages/core/src/__tests__/__snapshots__/angular.test.ts.snap index fd47c2f66c..e4b4ca3f93 100644 --- a/packages/core/src/__tests__/__snapshots__/angular.test.ts.snap +++ b/packages/core/src/__tests__/__snapshots__/angular.test.ts.snap @@ -57,7 +57,7 @@ export default class MyBasicRefComponent { return this.name.toLowerCase(); }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Received an update\\"); } @@ -130,7 +130,7 @@ export default class MyBasicRefComponent { return this.name.toLowerCase(); }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Received an update\\"); } @@ -1233,7 +1233,7 @@ export default class MyPreviousComponent { private _prevCount = this.count; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this._prevCount = this.count; } @@ -1289,7 +1289,7 @@ export default class MyPreviousComponent { private _prevCount = this.count; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this._prevCount = this.count; } @@ -4415,7 +4415,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -4484,7 +4484,7 @@ exports[`Angular > jsx > Javascript Test > basicForNoTagReference 2`] = ` ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; @@ -4716,7 +4716,7 @@ import { Component } from \\"@angular/core\\"; export default class MyBasicOnUpdateReturnComponent { name = \\"PatrickJS\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { const controller = new AbortController(); const signal = controller.signal; @@ -4768,7 +4768,7 @@ import { CommonModule } from \\"@angular/common\\"; export default class MyBasicOnUpdateReturnComponent { name = \\"PatrickJS\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { const controller = new AbortController(); const signal = controller.signal; @@ -5709,7 +5709,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -5770,7 +5770,7 @@ exports[`Angular > jsx > Javascript Test > dynamicComponentWithEventArg 2`] = ` ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; @@ -6127,7 +6127,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class MultipleOnUpdate { - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); console.log(\\"Runs on every update/rerender as well\\"); @@ -6164,7 +6164,7 @@ import { CommonModule } from \\"@angular/common\\"; imports: [CommonModule], }) export default class MultipleOnUpdate { - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); console.log(\\"Runs on every update/rerender as well\\"); @@ -6199,7 +6199,7 @@ export default class MultipleOnUpdateWithDeps { c = \\"c\\"; d = \\"d\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs when this.a or this.b changes\\", this.a, this.b); @@ -6249,7 +6249,7 @@ export default class MultipleOnUpdateWithDeps { c = \\"c\\"; d = \\"d\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs when this.a or this.b changes\\", this.a, this.b); @@ -6982,7 +6982,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class OnUpdate { - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); } @@ -7018,7 +7018,7 @@ import { CommonModule } from \\"@angular/common\\"; imports: [CommonModule], }) export default class OnUpdate { - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); } @@ -7052,7 +7052,7 @@ export default class OnUpdateWithDeps { a = \\"a\\"; b = \\"b\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log( \\"Runs when this.a, this.b or size changes\\", @@ -7098,7 +7098,7 @@ export default class OnUpdateWithDeps { a = \\"a\\"; b = \\"b\\"; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log( \\"Runs when this.a, this.b or size changes\\", @@ -7516,7 +7516,7 @@ export default class OnUpdate { }; }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.foo({ someOption: this.bar, @@ -7562,7 +7562,7 @@ export default class OnUpdate { }; }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.foo({ someOption: this.bar, @@ -7582,7 +7582,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -7874,7 +7874,7 @@ exports[`Angular > jsx > Javascript Test > renderBlock 2`] = ` ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; @@ -8198,7 +8198,7 @@ export default class RenderContent { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { dispatchNewContentToVisualEditor(this.content); } @@ -8259,7 +8259,7 @@ export default class RenderContent { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { dispatchNewContentToVisualEditor(this.content); } @@ -8928,7 +8928,7 @@ export default class MyBasicComponent { @Input() id; @Input() foo; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"props.id changed\\", this.id); console.log(\\"props.foo.value.bar.baz changed\\", this.foo.value.bar.baz); @@ -8971,7 +8971,7 @@ export default class MyBasicComponent { @Input() id; @Input() foo; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"props.id changed\\", this.id); console.log(\\"props.foo.value.bar.baz changed\\", this.foo.value.bar.baz); @@ -10186,7 +10186,13 @@ exports[`Angular > jsx > Typescript Test > AdvancedRef 1`] = ` "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, ViewChild, ElementRef, Input } from \\"@angular/core\\"; +import { + Component, + ViewChild, + ElementRef, + Input, + SimpleChanges, +} from \\"@angular/core\\"; export interface Props { showInput: boolean; @@ -10243,7 +10249,7 @@ export default class MyBasicRefComponent { return this.name.toLowerCase(); }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Received an update\\"); } @@ -10260,7 +10266,13 @@ export class MyBasicRefComponentModule {} `; exports[`Angular > jsx > Typescript Test > AdvancedRef 2`] = ` -"import { Component, ViewChild, ElementRef, Input } from \\"@angular/core\\"; +"import { + Component, + ViewChild, + ElementRef, + Input, + SimpleChanges, +} from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; export interface Props { @@ -10320,7 +10332,7 @@ export default class MyBasicRefComponent { return this.name.toLowerCase(); }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Received an update\\"); } @@ -11431,7 +11443,7 @@ exports[`Angular > jsx > Typescript Test > BasicRefPrevious 1`] = ` "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; export interface Props { showInput: boolean; @@ -11471,7 +11483,7 @@ export default class MyPreviousComponent { private _prevCount = this.count; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this._prevCount = this.count; } @@ -11488,7 +11500,7 @@ export class MyPreviousComponentModule {} `; exports[`Angular > jsx > Typescript Test > BasicRefPrevious 2`] = ` -"import { Component } from \\"@angular/core\\"; +"import { Component, SimpleChanges } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; export interface Props { @@ -11531,7 +11543,7 @@ export default class MyPreviousComponent { private _prevCount = this.count; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this._prevCount = this.count; } @@ -15093,7 +15105,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -15164,7 +15176,7 @@ exports[`Angular > jsx > Typescript Test > basicForNoTagReference 2`] = ` ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; @@ -15399,7 +15411,7 @@ exports[`Angular > jsx > Typescript Test > basicOnUpdateReturn 1`] = ` "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: @@ -15418,7 +15430,7 @@ import { Component } from \\"@angular/core\\"; export default class MyBasicOnUpdateReturnComponent { name = \\"PatrickJS\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { const controller = new AbortController(); const signal = controller.signal; @@ -15448,7 +15460,7 @@ export class MyBasicOnUpdateReturnComponentModule {} `; exports[`Angular > jsx > Typescript Test > basicOnUpdateReturn 2`] = ` -"import { Component } from \\"@angular/core\\"; +"import { Component, SimpleChanges } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; @Component({ @@ -15470,7 +15482,7 @@ import { CommonModule } from \\"@angular/common\\"; export default class MyBasicOnUpdateReturnComponent { name = \\"PatrickJS\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { const controller = new AbortController(); const signal = controller.signal; @@ -16485,7 +16497,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -16547,7 +16559,7 @@ exports[`Angular > jsx > Typescript Test > dynamicComponentWithEventArg 2`] = ` ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; @@ -16911,7 +16923,7 @@ exports[`Angular > jsx > Typescript Test > multipleOnUpdate 1`] = ` "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"multiple-on-update, MultipleOnUpdate\\", @@ -16927,7 +16939,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class MultipleOnUpdate { - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); console.log(\\"Runs on every update/rerender as well\\"); @@ -16945,7 +16957,7 @@ export class MultipleOnUpdateModule {} `; exports[`Angular > jsx > Typescript Test > multipleOnUpdate 2`] = ` -"import { Component } from \\"@angular/core\\"; +"import { Component, SimpleChanges } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; @Component({ @@ -16964,7 +16976,7 @@ import { CommonModule } from \\"@angular/common\\"; imports: [CommonModule], }) export default class MultipleOnUpdate { - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); console.log(\\"Runs on every update/rerender as well\\"); @@ -16978,7 +16990,7 @@ exports[`Angular > jsx > Typescript Test > multipleOnUpdateWithDeps 1`] = ` "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"multiple-on-update-with-deps, MultipleOnUpdateWithDeps\\", @@ -16999,7 +17011,7 @@ export default class MultipleOnUpdateWithDeps { c = \\"c\\"; d = \\"d\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs when this.a or this.b changes\\", this.a, this.b); @@ -17025,7 +17037,7 @@ export class MultipleOnUpdateWithDepsModule {} `; exports[`Angular > jsx > Typescript Test > multipleOnUpdateWithDeps 2`] = ` -"import { Component } from \\"@angular/core\\"; +"import { Component, SimpleChanges } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; @Component({ @@ -17049,7 +17061,7 @@ export default class MultipleOnUpdateWithDeps { c = \\"c\\"; d = \\"d\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs when this.a or this.b changes\\", this.a, this.b); @@ -17784,7 +17796,7 @@ exports[`Angular > jsx > Typescript Test > onUpdate 1`] = ` "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"on-update, OnUpdate\\", @@ -17800,7 +17812,7 @@ import { Component } from \\"@angular/core\\"; ], }) export default class OnUpdate { - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); } @@ -17817,7 +17829,7 @@ export class OnUpdateModule {} `; exports[`Angular > jsx > Typescript Test > onUpdate 2`] = ` -"import { Component } from \\"@angular/core\\"; +"import { Component, SimpleChanges } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; @Component({ @@ -17836,7 +17848,7 @@ import { CommonModule } from \\"@angular/common\\"; imports: [CommonModule], }) export default class OnUpdate { - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"Runs on every update/rerender\\"); } @@ -17849,7 +17861,7 @@ exports[`Angular > jsx > Typescript Test > onUpdateWithDeps 1`] = ` "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { size: string; @@ -17874,7 +17886,7 @@ export default class OnUpdateWithDeps { a = \\"a\\"; b = \\"b\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log( \\"Runs when this.a, this.b or size changes\\", @@ -17896,7 +17908,7 @@ export class OnUpdateWithDepsModule {} `; exports[`Angular > jsx > Typescript Test > onUpdateWithDeps 2`] = ` -"import { Component, Input } from \\"@angular/core\\"; +"import { Component, Input, SimpleChanges } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; type Props = { @@ -17924,7 +17936,7 @@ export default class OnUpdateWithDeps { a = \\"a\\"; b = \\"b\\"; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log( \\"Runs when this.a, this.b or size changes\\", @@ -18394,7 +18406,7 @@ exports[`Angular > jsx > Typescript Test > referencingFunInsideHook 1`] = ` "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"on-update, OnUpdate\\", @@ -18418,7 +18430,7 @@ export default class OnUpdate { }; }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.foo({ someOption: this.bar, @@ -18437,7 +18449,7 @@ export class OnUpdateModule {} `; exports[`Angular > jsx > Typescript Test > referencingFunInsideHook 2`] = ` -"import { Component } from \\"@angular/core\\"; +"import { Component, SimpleChanges } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; @Component({ @@ -18464,7 +18476,7 @@ export default class OnUpdate { }; }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.foo({ someOption: this.bar, @@ -18484,7 +18496,7 @@ import { ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; @@ -18788,7 +18800,7 @@ exports[`Angular > jsx > Typescript Test > renderBlock 2`] = ` ViewChild, ElementRef, Input, - ViewContainerRef, + ViewChild, TemplateRef, } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; @@ -19086,7 +19098,7 @@ exports[`Angular > jsx > Typescript Test > renderContentExample 1`] = ` "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { customComponents: string[]; @@ -19133,7 +19145,7 @@ export default class RenderContent { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { dispatchNewContentToVisualEditor(this.content); } @@ -19150,7 +19162,7 @@ export class RenderContentModule {} `; exports[`Angular > jsx > Typescript Test > renderContentExample 2`] = ` -"import { Component, Input } from \\"@angular/core\\"; +"import { Component, Input, SimpleChanges } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; type Props = { @@ -19202,7 +19214,7 @@ export default class RenderContent { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { dispatchNewContentToVisualEditor(this.content); } @@ -19907,7 +19919,7 @@ exports[`Angular > jsx > Typescript Test > signalsOnUpdate 1`] = ` "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component, Input } from \\"@angular/core\\"; +import { Component, Input, SimpleChanges } from \\"@angular/core\\"; type Props = { id: string; @@ -19938,7 +19950,7 @@ export default class MyBasicComponent { @Input() id!: Props[\\"id\\"]; @Input() foo!: Props[\\"foo\\"]; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"props.id changed\\", this.id); console.log(\\"props.foo.value.bar.baz changed\\", this.foo.bar.baz); @@ -19956,7 +19968,7 @@ export class MyBasicComponentModule {} `; exports[`Angular > jsx > Typescript Test > signalsOnUpdate 2`] = ` -"import { Component, Input } from \\"@angular/core\\"; +"import { Component, Input, SimpleChanges } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; type Props = { @@ -19990,7 +20002,7 @@ export default class MyBasicComponent { @Input() id!: Props[\\"id\\"]; @Input() foo!: Props[\\"foo\\"]; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"props.id changed\\", this.id); console.log(\\"props.foo.value.bar.baz changed\\", this.foo.bar.baz); @@ -21921,7 +21933,7 @@ export default class MyComponent { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"onAfterUpdate\\"); } @@ -21967,7 +21979,7 @@ export default class MyComponent { } } - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { console.log(\\"onAfterUpdate\\"); } @@ -22083,7 +22095,7 @@ export default class MyComponent { this.result = a_ * b_; }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.calculateResult(this.a, this.b); } @@ -22131,7 +22143,7 @@ export default class MyComponent { this.result = a_ * b_; }; - ngOnChanges() { + ngOnChanges(changes) { if (typeof window !== \\"undefined\\") { this.calculateResult(this.a, this.b); } @@ -23077,7 +23089,7 @@ exports[`Angular > svelte > Typescript Test > lifecycleHooks 1`] = ` "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"my-component, MyComponent\\", @@ -23099,7 +23111,7 @@ export default class MyComponent { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"onAfterUpdate\\"); } @@ -23120,7 +23132,7 @@ export class MyComponentModule {} `; exports[`Angular > svelte > Typescript Test > lifecycleHooks 2`] = ` -"import { Component } from \\"@angular/core\\"; +"import { Component, SimpleChanges } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; @Component({ @@ -23145,7 +23157,7 @@ export default class MyComponent { } } - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { console.log(\\"onAfterUpdate\\"); } @@ -23233,7 +23245,7 @@ exports[`Angular > svelte > Typescript Test > reactiveWithFn 1`] = ` "import { NgModule } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; -import { Component } from \\"@angular/core\\"; +import { Component, SimpleChanges } from \\"@angular/core\\"; @Component({ selector: \\"my-component, MyComponent\\", @@ -23261,7 +23273,7 @@ export default class MyComponent { this.result = a_ * b_; }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.calculateResult(this.a, this.b); } @@ -23278,7 +23290,7 @@ export class MyComponentModule {} `; exports[`Angular > svelte > Typescript Test > reactiveWithFn 2`] = ` -"import { Component } from \\"@angular/core\\"; +"import { Component, SimpleChanges } from \\"@angular/core\\"; import { CommonModule } from \\"@angular/common\\"; @Component({ @@ -23309,7 +23321,7 @@ export default class MyComponent { this.result = a_ * b_; }; - ngOnChanges() { + ngOnChanges(changes: SimpleChanges) { if (typeof window !== \\"undefined\\") { this.calculateResult(this.a, this.b); } diff --git a/packages/core/src/generators/angular/index.ts b/packages/core/src/generators/angular/index.ts index 89c83f496c..2253e79d7f 100644 --- a/packages/core/src/generators/angular/index.ts +++ b/packages/core/src/generators/angular/index.ts @@ -394,7 +394,7 @@ export const blockToAngular = ({ if (options.state === 'class-properties') { const inputsPropsStateName = `mergedInputs_${hashCodeAsString(allProps)}`; root.state[inputsPropsStateName] = { - code: 'null', + code: '{}' + (options.typescript ? ' as any' : ''), type: 'property', }; if (!root.hooks.onInit?.code.includes(inputsPropsStateName)) { @@ -942,12 +942,18 @@ export const componentToAngular: TranspilerGenerator = return `const defaultProps = {${defalutPropsString}};\n`; }; + const angularCoreImports = [ + ...(outputs.length ? ['Output', 'EventEmitter'] : []), + ...(options?.experimental?.inject ? ['Inject', 'forwardRef'] : []), + 'Component', + ...(domRefs.size || dynamicComponents.size ? ['ViewChild', 'ElementRef'] : []), + ...(props.size ? ['Input'] : []), + ...(dynamicComponents.size ? ['ViewChild', 'TemplateRef'] : []), + ...(json.hooks.onUpdate?.length && options.typescript ? ['SimpleChanges'] : []), + ].join(', '); + let str = dedent` - import { ${outputs.length ? 'Output, EventEmitter, \n' : ''} ${ - options?.experimental?.inject ? 'Inject, forwardRef,' : '' - } Component ${domRefs.size || dynamicComponents.size ? ', ViewChild, ElementRef' : ''}${ - props.size ? ', Input' : '' - } ${dynamicComponents.size ? ', ViewContainerRef, TemplateRef' : ''} } from '@angular/core'; + import { ${angularCoreImports} } from '@angular/core'; ${options.standalone ? `import { CommonModule } from '@angular/common';` : ''} ${json.types ? json.types.join('\n') : ''} @@ -1077,7 +1083,7 @@ export const componentToAngular: TranspilerGenerator = ${ !json.hooks.onUpdate?.length ? '' - : `ngOnChanges() { + : `ngOnChanges(changes${options.typescript ? ': SimpleChanges' : ''}) { if (typeof window !== 'undefined') { ${json.hooks.onUpdate?.reduce((code, hook) => { code += hook.code;