@@ -45,6 +45,14 @@ export class InClassMethodOk1 { o(array: number[] = [], rParam: string): void {
45
45
export class InClassMethodOk2 { o ( array : T | undefined = [ ] , rParam : string ) : void { } } ;
46
46
export class InClassMethodBad { o ( array : T = [ ] , rParam : string ) : void { } } ;
47
47
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
+ }
48
56
//// [fnDecl.d.ts] ////
49
57
type T = number [ ] ;
50
58
export declare function fnDeclBasic1 ( p : number [ ] | string [ ] | [ T ] | undefined , rParam : string ) : void ;
@@ -121,6 +129,13 @@ export declare class InClassMethodOk2 {
121
129
export declare class InClassMethodBad {
122
130
o ( array : T | undefined , rParam : string ) : void ;
123
131
}
132
+ declare class Bar {
133
+ }
134
+ export declare class ClsWithRequiredInitializedParameter {
135
+ private arr ;
136
+ private bool ;
137
+ constructor ( arr : Bar | undefined , bool : boolean ) ;
138
+ }
124
139
export { } ;
125
140
126
141
@@ -134,9 +149,10 @@ fnDecl.ts(32,45): error TS9025: Declaration emit for this parameter requires imp
134
149
fnDecl . ts ( 37 , 47 ) : error TS9025 : Declaration emit for this parameter requires implicitly adding undefined to its type . This is not supported with -- isolatedDeclarations .
135
150
fnDecl . ts ( 41 , 37 ) : error TS9025 : Declaration emit for this parameter requires implicitly adding undefined to its type . This is not supported with -- isolatedDeclarations .
136
151
fnDecl . 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 .
137
153
138
154
139
- = === fnDecl . ts ( 9 errors ) === =
155
+ = === fnDecl . ts ( 10 errors ) === =
140
156
type T = number [ ]
141
157
export function fnDeclBasic1 ( p : number [ ] | string [ ] | [ T ] = [ ] , rParam : string ) : void { } ;
142
158
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
210
226
! ! ! error TS9025 : Declaration emit for this parameter requires implicitly adding undefined to its type . This is not supported with -- isolatedDeclarations .
211
227
! ! ! related TS9028 fnDecl . ts :45 :35 : Add a type annotation to the parameter array .
212
228
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