diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 35d7307d4bd..35d63b7e2e7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9955,6 +9955,11 @@ namespace ts { neverType; } + /** + * Add undefined or null or both to a type if they are missing. + * @param type - type to add undefined and/or null to if not present + * @param flags - Either TypeFlags.Undefined or TypeFlags.Null, or both + */ function getNullableType(type: Type, flags: TypeFlags): Type { const missing = (flags & ~type.flags) & (TypeFlags.Undefined | TypeFlags.Null); return missing === 0 ? type :