@@ -45,6 +45,14 @@ export class InClassMethodOk1 { o(array: number[] = [], rParam: string): void {
4545export class InClassMethodOk2 { o ( array : T | undefined = [ ] , rParam : string ) : void { } } ;
4646export class InClassMethodBad { o ( array : T = [ ] , rParam : string ) : void { } } ;
4747
48+ // https://github.com/microsoft/TypeScript/issues/60976
49+ class Bar { }
50+ export class ClsWithRequiredInitializedParameter {
51+ constructor (
52+ private arr : Bar = new Bar ( ) ,
53+ private bool : boolean ,
54+ ) { }
55+ }
4856//// [fnDecl.d.ts] ////
4957type T = number [ ] ;
5058export declare function fnDeclBasic1 ( p : number [ ] | string [ ] | [ T ] | undefined , rParam : string ) : void ;
@@ -121,6 +129,13 @@ export declare class InClassMethodOk2 {
121129export declare class InClassMethodBad {
122130 o ( array : T | undefined , rParam : string ) : void ;
123131}
132+ declare class Bar {
133+ }
134+ export declare class ClsWithRequiredInitializedParameter {
135+ private arr ;
136+ private bool ;
137+ constructor ( arr : Bar | undefined , bool : boolean ) ;
138+ }
124139export { } ;
125140
126141
@@ -134,9 +149,10 @@ fnDecl.ts(32,45): error TS9025: Declaration emit for this parameter requires imp
134149fnDecl . ts ( 37 , 47 ) : error TS9025 : Declaration emit for this parameter requires implicitly adding undefined to its type . This is not supported with -- isolatedDeclarations .
135150fnDecl . ts ( 41 , 37 ) : error TS9025 : Declaration emit for this parameter requires implicitly adding undefined to its type . This is not supported with -- isolatedDeclarations .
136151fnDecl . ts ( 45 , 35 ) : error TS9025 : Declaration emit for this parameter requires implicitly adding undefined to its type . This is not supported with -- isolatedDeclarations .
152+ fnDecl . ts ( 51 , 5 ) : error TS9025 : Declaration emit for this parameter requires implicitly adding undefined to its type . This is not supported with -- isolatedDeclarations .
137153
138154
139- = === fnDecl . ts ( 9 errors ) === =
155+ = === fnDecl . ts ( 10 errors ) === =
140156 type T = number [ ]
141157 export function fnDeclBasic1 ( p : number [ ] | string [ ] | [ T ] = [ ] , rParam : string ) : void { } ;
142158 export function fnDeclBasic2 ( p : ( n : T ) => T = ( ) => null ! , rParam : string ) : void { } ;
@@ -210,4 +226,14 @@ fnDecl.ts(45,35): error TS9025: Declaration emit for this parameter requires imp
210226! ! ! error TS9025 : Declaration emit for this parameter requires implicitly adding undefined to its type . This is not supported with -- isolatedDeclarations .
211227! ! ! related TS9028 fnDecl . ts :45 :35 : Add a type annotation to the parameter array .
212228
213-
229+ // https://github.com/microsoft/TypeScript/issues/60976
230+ class Bar { }
231+ export class ClsWithRequiredInitializedParameter {
232+ constructor (
233+ private arr : Bar = new Bar ( ) ,
234+ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
235+ ! ! ! error TS9025 : Declaration emit for this parameter requires implicitly adding undefined to its type . This is not supported with -- isolatedDeclarations .
236+ ! ! ! related TS9028 fnDecl . ts :51 :5 : Add a type annotation to the parameter arr .
237+ private bool : boolean ,
238+ ) { }
239+ }
0 commit comments