Skip to content

Commit 1fb4678

Browse files
committed
Revert "fix(core): allow static attributes for explicit input transforms"
This reverts commit 9b9b0e9. This broke g3. Not sure yet why it didn't break externally. We can investigate and fix following this revert.
1 parent b178e83 commit 1fb4678

4 files changed

Lines changed: 10 additions & 73 deletions

File tree

‎goldens/public-api/core/index.api.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,8 +1029,8 @@ export interface InputFunction {
10291029
<T>(initialValue: undefined, opts: InputOptionsWithoutTransform<T>): InputSignal<T | undefined>;
10301030
<T, TransformT>(initialValue: T, opts: InputOptionsWithTransform<T, TransformT>): InputSignalWithTransform<T, TransformT>;
10311031
<T, TransformT>(initialValue: undefined, opts: InputOptionsWithTransform<T | undefined, TransformT>): InputSignalWithTransform<T | undefined, TransformT>;
1032-
<T>(initialValue: T, opts: InputOptionsWithTransform<T, unknown>): InputSignalWithTransform<T, T | string>;
1033-
<T>(initialValue: undefined, opts: InputOptionsWithTransform<T | undefined, unknown>): InputSignalWithTransform<T | undefined, T | undefined | string>;
1032+
<T>(initialValue: T, opts: InputOptionsWithTransform<T, unknown>): InputSignalWithTransform<T, T>;
1033+
<T>(initialValue: undefined, opts: InputOptionsWithTransform<T | undefined, unknown>): InputSignalWithTransform<T | undefined, T | undefined>;
10341034
required: {
10351035
<T>(opts?: InputOptionsWithoutTransform<T>): InputSignal<T>;
10361036
<T, TransformT>(opts: InputOptionsWithTransform<T, TransformT>): InputSignalWithTransform<T, TransformT>;

‎packages/compiler-cli/test/ngtsc/authoring_inputs_spec.ts‎

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -320,66 +320,6 @@ runInEachFileSystem(() => {
320320
);
321321
});
322322

323-
it('should allow text attributes for explicit signal inputs with booleanAttribute transform', () => {
324-
env.write(
325-
'test.ts',
326-
`
327-
import {booleanAttribute, Component, Directive, input} from '@angular/core';
328-
329-
@Directive({
330-
selector: '[directiveName]',
331-
})
332-
export class TestDir {
333-
dismissible = input<boolean>(true, {transform: booleanAttribute});
334-
}
335-
336-
@Component({
337-
template: \`
338-
<div directiveName [dismissible]="true"></div>
339-
<div directiveName dismissible="true"></div>
340-
<div directiveName dismissible></div>
341-
\`,
342-
imports: [TestDir],
343-
})
344-
export class TestComp {
345-
}
346-
`,
347-
);
348-
349-
const diagnostics = env.driveDiagnostics();
350-
expect(diagnostics).toEqual([]);
351-
});
352-
353-
it('should allow text attributes for explicit signal inputs with numberAttribute transform', () => {
354-
env.write(
355-
'test.ts',
356-
`
357-
import {Component, Directive, input, numberAttribute} from '@angular/core';
358-
359-
@Directive({
360-
selector: '[directiveName]',
361-
})
362-
export class TestDir {
363-
count = input<number>(0, {transform: numberAttribute});
364-
}
365-
366-
@Component({
367-
template: \`
368-
<div directiveName [count]="1"></div>
369-
<div directiveName count="1"></div>
370-
<div directiveName count=""></div>
371-
\`,
372-
imports: [TestDir],
373-
})
374-
export class TestComp {
375-
}
376-
`,
377-
);
378-
379-
const diagnostics = env.driveDiagnostics();
380-
expect(diagnostics).toEqual([]);
381-
});
382-
383323
it('should report unset required inputs', () => {
384324
env.write(
385325
'test.ts',

‎packages/core/src/authoring/input/input.ts‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,17 @@ export interface InputFunction {
7979
): InputSignalWithTransform<T | undefined, TransformT>;
8080
/**
8181
* Declares an input of type `T` with an initial value and a transform function
82-
* that accepts values of the same type, or string values from static attributes.
82+
* that accepts values of the same type.
8383
*/
84-
<T>(
85-
initialValue: T,
86-
opts: InputOptionsWithTransform<T, unknown>,
87-
): InputSignalWithTransform<T, T | string>;
84+
<T>(initialValue: T, opts: InputOptionsWithTransform<T, unknown>): InputSignalWithTransform<T, T>;
8885
/**
8986
* Declares an input of type `T|undefined` without an initial value and with a transform
90-
* function that accepts values of the same type, or string values from static attributes.
87+
* function that accepts values of the same type.
9188
*/
9289
<T>(
9390
initialValue: undefined,
9491
opts: InputOptionsWithTransform<T | undefined, unknown>,
95-
): InputSignalWithTransform<T | undefined, T | undefined | string>;
92+
): InputSignalWithTransform<T | undefined, T | undefined>;
9693

9794
/**
9895
* Initializes a required input.

‎packages/core/test/authoring/signal_input_signature_test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ export class InputSignatureTest {
102102
transform: (v: string | boolean) => '',
103103
});
104104

105-
/** boolean, string | boolean */
105+
/** boolean, boolean */
106106
explicitReadWithBooleanAttributeTransform = input<boolean>(false, {transform: booleanAttribute});
107-
/** number, string | number */
107+
/** number, number */
108108
explicitReadWithNumberAttributeTransform = input<number>(0, {transform: numberAttribute});
109-
/** boolean | undefined, string | boolean | undefined */
109+
/** boolean | undefined, boolean | undefined */
110110
explicitReadWithUndefinedInitialBooleanAttributeTransform = input<boolean>(undefined, {
111111
transform: booleanAttribute,
112112
});
113-
/** number | undefined, string | number | undefined */
113+
/** number | undefined, number | undefined */
114114
explicitReadWithUndefinedInitialNumberAttributeTransform = input<number>(undefined, {
115115
transform: numberAttribute,
116116
});

0 commit comments

Comments
 (0)