diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 02ccc6d396..c802225c3c 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -17776,7 +17776,7 @@ func (c *Checker) addOptionalityEx(t *Type, isProperty bool, isOptional bool) *T } func (c *Checker) getOptionalType(t *Type, isProperty bool) *Type { - // debug.Assert(c.strictNullChecks) // TODO: fix bug in isRequiredInitializedParameter + debug.Assert(c.strictNullChecks) missingOrUndefined := core.IfElse(isProperty, c.undefinedOrMissingType, c.undefinedType) if t == missingOrUndefined || t.flags&TypeFlagsUnion != 0 && t.Types()[0] == missingOrUndefined { return t diff --git a/internal/checker/emitresolver.go b/internal/checker/emitresolver.go index 9e20254047..f468f7ab1e 100644 --- a/internal/checker/emitresolver.go +++ b/internal/checker/emitresolver.go @@ -552,7 +552,7 @@ func (r *emitResolver) isOptionalUninitializedParameterProperty(parameter *ast.N } func (r *emitResolver) isRequiredInitializedParameter(parameter *ast.Node, enclosingDeclaration *ast.Node) bool { - if r.checker.strictNullChecks || r.isOptionalParameter(parameter) || /*isJSDocParameterTag(parameter) ||*/ parameter.Initializer() == nil { // !!! TODO: JSDoc Support + if !r.checker.strictNullChecks || r.isOptionalParameter(parameter) || /*isJSDocParameterTag(parameter) ||*/ parameter.Initializer() == nil { // !!! TODO: JSDoc Support return false } if ast.HasSyntacticModifier(parameter, ast.ModifierFlagsParameterPropertyModifier) { diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js index acf508195e..957f53367d 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js @@ -31,6 +31,9 @@ export function fnWithPartialAnnotationOnDefaultparam(x: P = null! as P, b: numb //// [declarationEmitCastReusesTypeNode1.d.ts] +type P = {} & { + name: string; +}; export declare let vLet: { name: string; }; @@ -77,6 +80,4 @@ declare const _default: { }; export default _default; // allows `undefined` on the input side, thanks to the initializer -export declare function fnWithPartialAnnotationOnDefaultparam(x: { - name: string; -}, b: number): void; +export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js.diff index 0a258fd354..6e0b361190 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js.diff @@ -1,12 +1,9 @@ --- old.declarationEmitCastReusesTypeNode1(strictnullchecks=false).js +++ new.declarationEmitCastReusesTypeNode1(strictnullchecks=false).js -@@= skipped -30, +30 lines =@@ - - - //// [declarationEmitCastReusesTypeNode1.d.ts] --type P = {} & { -- name: string; --}; +@@= skipped -33, +33 lines =@@ + type P = {} & { + name: string; + }; -export declare let vLet: P; -export declare const vConst: P; -export declare function fn(p?: P): void; @@ -66,8 +63,5 @@ + name: string; +}; export default _default; --export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; +// allows `undefined` on the input side, thanks to the initializer -+export declare function fnWithPartialAnnotationOnDefaultparam(x: { -+ name: string; -+}, b: number): void; \ No newline at end of file + export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js index 74ec5facb9..da49ad189a 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js @@ -31,9 +31,6 @@ export function fnWithPartialAnnotationOnDefaultparam(x: P = null! as P, b: numb //// [declarationEmitCastReusesTypeNode1.d.ts] -type P = {} & { - name: string; -}; export declare let vLet: { name: string; }; @@ -45,7 +42,7 @@ export declare function fn(p?: { }): void; export declare function fnWithRequiredDefaultParam(p: { name: string; -}, req: number): void; +} | undefined, req: number): void; export declare class C { ctorField: { name: string; @@ -64,7 +61,7 @@ export declare class C { }): void; methodWithRequiredDefault(p: { name: string; - }, req: number): void; + } | undefined, req: number): void; constructor(ctorField?: { name: string; }); @@ -80,4 +77,6 @@ declare const _default: { }; export default _default; // allows `undefined` on the input side, thanks to the initializer -export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; +export declare function fnWithPartialAnnotationOnDefaultparam(x: { + name: string; +} | undefined, b: number): void; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js.diff index 1c3d657908..a09997b854 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js.diff @@ -1,9 +1,12 @@ --- old.declarationEmitCastReusesTypeNode1(strictnullchecks=true).js +++ new.declarationEmitCastReusesTypeNode1(strictnullchecks=true).js -@@= skipped -33, +33 lines =@@ - type P = {} & { - name: string; - }; +@@= skipped -30, +30 lines =@@ + + + //// [declarationEmitCastReusesTypeNode1.d.ts] +-type P = {} & { +- name: string; +-}; -export declare let vLet: P; -export declare const vConst: P; -export declare function fn(p?: P): void; @@ -19,7 +22,7 @@ +}): void; +export declare function fnWithRequiredDefaultParam(p: { + name: string; -+}, req: number): void; ++} | undefined, req: number): void; export declare class C { - ctorField: P; - field: P; @@ -47,7 +50,7 @@ + }): void; + methodWithRequiredDefault(p: { + name: string; -+ }, req: number): void; ++ } | undefined, req: number): void; + constructor(ctorField?: { + name: string; + }); @@ -65,4 +68,6 @@ export default _default; -export declare function fnWithPartialAnnotationOnDefaultparam(x: P | undefined, b: number): void; +// allows `undefined` on the input side, thanks to the initializer -+export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; \ No newline at end of file ++export declare function fnWithPartialAnnotationOnDefaultparam(x: { ++ name: string; ++} | undefined, b: number): void; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js index f6a4253622..6a062f6919 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js @@ -75,6 +75,6 @@ declare const _default: { }; export default _default; // allows `undefined` on the input side, thanks to the initializer -export declare function fnWithPartialAnnotationOnDefaultparam(x: { +export declare function fnWithPartialAnnotationOnDefaultparam(x: {} & { name: string; }, b: number): void; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js.diff index fbf00cd152..bbf234c6c8 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js.diff @@ -75,8 +75,7 @@ name: string; }; export default _default; --export declare function fnWithPartialAnnotationOnDefaultparam(x: {} & { +// allows `undefined` on the input side, thanks to the initializer -+export declare function fnWithPartialAnnotationOnDefaultparam(x: { + export declare function fnWithPartialAnnotationOnDefaultparam(x: {} & { name: string; }, b: number): void; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js index 0ca5232d78..ac5e86000a 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js @@ -40,7 +40,7 @@ export declare function fn(p?: { }): void; export declare function fnWithRequiredDefaultParam(p: { name: string; -}, req: number): void; +} | undefined, req: number): void; export declare class C { ctorField: { name: string; @@ -59,7 +59,7 @@ export declare class C { }): void; methodWithRequiredDefault(p: { name: string; - }, req: number): void; + } | undefined, req: number): void; constructor(ctorField?: { name: string; }); @@ -75,6 +75,6 @@ declare const _default: { }; export default _default; // allows `undefined` on the input side, thanks to the initializer -export declare function fnWithPartialAnnotationOnDefaultparam(x: {} & { +export declare function fnWithPartialAnnotationOnDefaultparam(x: { name: string; -}, b: number): void; +} | undefined, b: number): void; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js.diff index 683130f561..b3e249e4a9 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js.diff @@ -24,7 +24,7 @@ +export declare function fnWithRequiredDefaultParam(p: { name: string; -}) | undefined, req: number): void; -+}, req: number): void; ++} | undefined, req: number): void; export declare class C { - ctorField: {} & { - name: string; @@ -59,7 +59,7 @@ name: string; - }) | undefined, req: number): void; - constructor(ctorField?: {} & { -+ }, req: number): void; ++ } | undefined, req: number): void; + constructor(ctorField?: { name: string; }); @@ -79,7 +79,7 @@ export default _default; -export declare function fnWithPartialAnnotationOnDefaultparam(x: ({} & { +// allows `undefined` on the input side, thanks to the initializer -+export declare function fnWithPartialAnnotationOnDefaultparam(x: {} & { ++export declare function fnWithPartialAnnotationOnDefaultparam(x: { name: string; -}) | undefined, b: number): void; -+}, b: number): void; \ No newline at end of file ++} | undefined, b: number): void; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js index ddad8a9c15..7273fc0707 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js @@ -31,6 +31,9 @@ export function fnWithPartialAnnotationOnDefaultparam(x: P =

null!, b: number //// [declarationEmitCastReusesTypeNode3.d.ts] +type P = {} & { + name: string; +}; export declare let vLet: { name: string; }; @@ -77,6 +80,4 @@ declare const _default: { }; export default _default; // allows `undefined` on the input side, thanks to the initializer -export declare function fnWithPartialAnnotationOnDefaultparam(x: { - name: string; -}, b: number): void; +export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js.diff index b62f8518e3..e313ad7a37 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js.diff @@ -1,12 +1,9 @@ --- old.declarationEmitCastReusesTypeNode3(strictnullchecks=false).js +++ new.declarationEmitCastReusesTypeNode3(strictnullchecks=false).js -@@= skipped -30, +30 lines =@@ - - - //// [declarationEmitCastReusesTypeNode3.d.ts] --type P = {} & { -- name: string; --}; +@@= skipped -33, +33 lines =@@ + type P = {} & { + name: string; + }; -export declare let vLet: P; -export declare const vConst: P; -export declare function fn(p?: P): void; @@ -66,8 +63,5 @@ + name: string; +}; export default _default; --export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; +// allows `undefined` on the input side, thanks to the initializer -+export declare function fnWithPartialAnnotationOnDefaultparam(x: { -+ name: string; -+}, b: number): void; \ No newline at end of file + export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js index 5a02a8dde5..2064815c40 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js @@ -31,9 +31,6 @@ export function fnWithPartialAnnotationOnDefaultparam(x: P =

null!, b: number //// [declarationEmitCastReusesTypeNode3.d.ts] -type P = {} & { - name: string; -}; export declare let vLet: { name: string; }; @@ -45,7 +42,7 @@ export declare function fn(p?: { }): void; export declare function fnWithRequiredDefaultParam(p: { name: string; -}, req: number): void; +} | undefined, req: number): void; export declare class C { ctorField: { name: string; @@ -64,7 +61,7 @@ export declare class C { }): void; methodWithRequiredDefault(p: { name: string; - }, req: number): void; + } | undefined, req: number): void; constructor(ctorField?: { name: string; }); @@ -80,4 +77,6 @@ declare const _default: { }; export default _default; // allows `undefined` on the input side, thanks to the initializer -export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; +export declare function fnWithPartialAnnotationOnDefaultparam(x: { + name: string; +} | undefined, b: number): void; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js.diff index dacee70953..ef89503559 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js.diff @@ -1,9 +1,12 @@ --- old.declarationEmitCastReusesTypeNode3(strictnullchecks=true).js +++ new.declarationEmitCastReusesTypeNode3(strictnullchecks=true).js -@@= skipped -33, +33 lines =@@ - type P = {} & { - name: string; - }; +@@= skipped -30, +30 lines =@@ + + + //// [declarationEmitCastReusesTypeNode3.d.ts] +-type P = {} & { +- name: string; +-}; -export declare let vLet: P; -export declare const vConst: P; -export declare function fn(p?: P): void; @@ -19,7 +22,7 @@ +}): void; +export declare function fnWithRequiredDefaultParam(p: { + name: string; -+}, req: number): void; ++} | undefined, req: number): void; export declare class C { - ctorField: P; - field: P; @@ -47,7 +50,7 @@ + }): void; + methodWithRequiredDefault(p: { + name: string; -+ }, req: number): void; ++ } | undefined, req: number): void; + constructor(ctorField?: { + name: string; + }); @@ -65,4 +68,6 @@ export default _default; -export declare function fnWithPartialAnnotationOnDefaultparam(x: P | undefined, b: number): void; +// allows `undefined` on the input side, thanks to the initializer -+export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; \ No newline at end of file ++export declare function fnWithPartialAnnotationOnDefaultparam(x: { ++ name: string; ++} | undefined, b: number): void; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).js index b8b0aba5fd..1e4f4486b1 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).js @@ -95,6 +95,4 @@ export default /** @type {P} */ _default; * @param {P} x * @param {number} b */ -export declare function fnWithPartialAnnotationOnDefaultparam(x: { - name?: string; -}, b: number): void; +export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).js.diff index f517d0bdc5..f3a0058677 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=false).js.diff @@ -76,7 +76,6 @@ -declare const _default: P; -export default _default; -export type P = {} & { -+export declare function fnWithPartialAnnotationOnDefaultparam(x: { - name?: string; +- name?: string; -}; -+}, b: number): void; \ No newline at end of file ++export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).js index c182396ff6..2c541d1a1e 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).js @@ -57,7 +57,7 @@ export declare function fn(p?: { /** @param {number} req */ export declare function fnWithRequiredDefaultParam(p: { name?: string | undefined; -}, req: number): void; +} | undefined, req: number): void; export declare class C { field: { name?: string | undefined; @@ -74,7 +74,7 @@ export declare class C { /** @param {number} req */ methodWithRequiredDefault(p: { name?: string | undefined; - }, req: number): void; + } | undefined, req: number): void; constructor(ctorField?: { name?: string | undefined; }); @@ -95,4 +95,6 @@ export default /** @type {P} */ _default; * @param {P} x * @param {number} b */ -export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; +export declare function fnWithPartialAnnotationOnDefaultparam(x: { + name?: string | undefined; +} | undefined, b: number): void; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).js.diff index fd2e062b86..d23c7499ea 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode4(strictnullchecks=true).js.diff @@ -21,7 +21,7 @@ -export function fnWithRequiredDefaultParam(p: P | undefined, req: number): void; +export declare function fnWithRequiredDefaultParam(p: { + name?: string | undefined; -+}, req: number): void; ++} | undefined, req: number): void; +export declare class C { + field: { + name?: string | undefined; @@ -38,7 +38,7 @@ + /** @param {number} req */ + methodWithRequiredDefault(p: { + name?: string | undefined; -+ }, req: number): void; ++ } | undefined, req: number): void; + constructor(ctorField?: { + name?: string | undefined; + }); @@ -78,4 +78,6 @@ -export type P = {} & { - name?: string; -}; -+export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; \ No newline at end of file ++export declare function fnWithPartialAnnotationOnDefaultparam(x: { ++ name?: string | undefined; ++} | undefined, b: number): void; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/defaultParameterAddsUndefinedWithStrictNullChecks.js b/testdata/baselines/reference/submodule/compiler/defaultParameterAddsUndefinedWithStrictNullChecks.js index 3e3981fa1d..d62738ed65 100644 --- a/testdata/baselines/reference/submodule/compiler/defaultParameterAddsUndefinedWithStrictNullChecks.js +++ b/testdata/baselines/reference/submodule/compiler/defaultParameterAddsUndefinedWithStrictNullChecks.js @@ -111,10 +111,10 @@ function removeNothing(y = cond ? true : undefined) { //// [defaultParameterAddsUndefinedWithStrictNullChecks.d.ts] declare function f(addUndefined1?: string, addUndefined2?: number): number; -declare function g(addUndefined: string, addDefined: number): number; +declare function g(addUndefined: string | undefined, addDefined: number): number; declare let total: number; -declare function foo1(x: string, b: number): void; -declare function foo2(x: string, b: number): void; +declare function foo1(x: string | undefined, b: number): void; +declare function foo2(x: string | undefined, b: number): void; declare function foo3(x: string | undefined, b: number): void; declare function foo4(x: string | undefined, b: number): void; type OptionalNullableString = string | null | undefined; diff --git a/testdata/baselines/reference/submodule/compiler/defaultParameterAddsUndefinedWithStrictNullChecks.js.diff b/testdata/baselines/reference/submodule/compiler/defaultParameterAddsUndefinedWithStrictNullChecks.js.diff deleted file mode 100644 index a35fee7d8b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/defaultParameterAddsUndefinedWithStrictNullChecks.js.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.defaultParameterAddsUndefinedWithStrictNullChecks.js -+++ new.defaultParameterAddsUndefinedWithStrictNullChecks.js -@@= skipped -110, +110 lines =@@ - - //// [defaultParameterAddsUndefinedWithStrictNullChecks.d.ts] - declare function f(addUndefined1?: string, addUndefined2?: number): number; --declare function g(addUndefined: string | undefined, addDefined: number): number; -+declare function g(addUndefined: string, addDefined: number): number; - declare let total: number; --declare function foo1(x: string | undefined, b: number): void; --declare function foo2(x: string | undefined, b: number): void; -+declare function foo1(x: string, b: number): void; -+declare function foo2(x: string, b: number): void; - declare function foo3(x: string | undefined, b: number): void; - declare function foo4(x: string | undefined, b: number): void; - type OptionalNullableString = string | null | undefined; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/parameterPropertyInConstructor4.js b/testdata/baselines/reference/submodule/compiler/parameterPropertyInConstructor4.js index 3c030206bd..acefaf0d99 100644 --- a/testdata/baselines/reference/submodule/compiler/parameterPropertyInConstructor4.js +++ b/testdata/baselines/reference/submodule/compiler/parameterPropertyInConstructor4.js @@ -23,5 +23,5 @@ exports.C = C; //// [parameterPropertyInConstructor4.d.ts] export declare class C { a: number[]; - constructor(a: number[], b: number); + constructor(a: number[] | undefined, b: number); } diff --git a/testdata/baselines/reference/submodule/compiler/parameterPropertyInConstructor4.js.diff b/testdata/baselines/reference/submodule/compiler/parameterPropertyInConstructor4.js.diff index 70531d1855..535941dc26 100644 --- a/testdata/baselines/reference/submodule/compiler/parameterPropertyInConstructor4.js.diff +++ b/testdata/baselines/reference/submodule/compiler/parameterPropertyInConstructor4.js.diff @@ -7,11 +7,4 @@ + a; constructor(a = [], b) { this.a = a; - } -@@= skipped -10, +11 lines =@@ - //// [parameterPropertyInConstructor4.d.ts] - export declare class C { - a: number[]; -- constructor(a: number[] | undefined, b: number); -+ constructor(a: number[], b: number); - } \ No newline at end of file + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/verbatim-declarations-parameters.js b/testdata/baselines/reference/submodule/compiler/verbatim-declarations-parameters.js index f39d4ca54c..d52d67d585 100644 --- a/testdata/baselines/reference/submodule/compiler/verbatim-declarations-parameters.js +++ b/testdata/baselines/reference/submodule/compiler/verbatim-declarations-parameters.js @@ -75,5 +75,7 @@ export declare function foo1( // Type node is accurate, preserve reuseTypeNode: Map | undefined, reuseTypeNode2: Exclude, // Resolve type node, requires adding | undefined -resolveType: Map, requiredParam: number): void; +resolveType: { + [x: string]: any; +} | undefined, requiredParam: number): void; export {}; diff --git a/testdata/baselines/reference/submodule/compiler/verbatim-declarations-parameters.js.diff b/testdata/baselines/reference/submodule/compiler/verbatim-declarations-parameters.js.diff index cd0763b7af..ad3e65ee24 100644 --- a/testdata/baselines/reference/submodule/compiler/verbatim-declarations-parameters.js.diff +++ b/testdata/baselines/reference/submodule/compiler/verbatim-declarations-parameters.js.diff @@ -32,5 +32,7 @@ +// Type node is accurate, preserve +reuseTypeNode: Map | undefined, reuseTypeNode2: Exclude, +// Resolve type node, requires adding | undefined -+resolveType: Map, requiredParam: number): void; ++resolveType: { ++ [x: string]: any; ++} | undefined, requiredParam: number): void; export {}; \ No newline at end of file