diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index fe94434490c..6add1cccb58 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -16,7 +16,7 @@ Please fill in the *entire* template below. --> -**TypeScript Version:** 3.1.0-dev.201xxxxx +**TypeScript Version:** 3.2.0-dev.201xxxxx **Search Terms:** diff --git a/package.json b/package.json index 159788e697f..5a8ad595806 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "http://typescriptlang.org/", - "version": "3.1.0", + "version": "3.2.0", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7e9080164d0..0cf88750a78 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -77,6 +77,7 @@ namespace ts { const allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions); const strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks"); const strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes"); + const strictBindCallApply = getStrictOptionValue(compilerOptions, "strictBindCallApply"); const strictPropertyInitialization = getStrictOptionValue(compilerOptions, "strictPropertyInitialization"); const noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny"); const noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis"); @@ -476,6 +477,8 @@ namespace ts { let globalObjectType: ObjectType; let globalFunctionType: ObjectType; + let globalCallableFunctionType: ObjectType; + let globalNewableFunctionType: ObjectType; let globalArrayType: GenericType; let globalReadonlyArrayType: GenericType; let globalStringType: ObjectType; @@ -1708,7 +1711,9 @@ namespace ts { function checkResolvedBlockScopedVariable(result: Symbol, errorLocation: Node): void { Debug.assert(!!(result.flags & SymbolFlags.BlockScopedVariable || result.flags & SymbolFlags.Class || result.flags & SymbolFlags.Enum)); // Block-scoped variables cannot be used before their definition - const declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) || isClassLike(d) || (d.kind === SyntaxKind.EnumDeclaration) ? d : undefined); + const declaration = find( + result.declarations, + d => isBlockOrCatchScoped(d) || isClassLike(d) || (d.kind === SyntaxKind.EnumDeclaration) || isInJSFile(d) && !!getJSDocEnumTag(d)); if (declaration === undefined) return Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined"); @@ -7391,8 +7396,12 @@ namespace ts { if (symbol && symbolIsValue(symbol)) { return symbol; } - if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) { - const symbol = getPropertyOfObjectType(globalFunctionType, name); + const functionType = resolved === anyFunctionType ? globalFunctionType : + resolved.callSignatures.length ? globalCallableFunctionType : + resolved.constructSignatures.length ? globalNewableFunctionType : + undefined; + if (functionType) { + const symbol = getPropertyOfObjectType(functionType, name); if (symbol) { return symbol; } @@ -13250,10 +13259,8 @@ namespace ts { const targetCount = getParameterCount(target); const sourceRestType = getEffectiveRestType(source); const targetRestType = getEffectiveRestType(target); - const paramCount = targetRestType ? Math.min(targetCount - 1, sourceCount) : - sourceRestType ? targetCount : - Math.min(sourceCount, targetCount); - + const targetNonRestCount = targetRestType ? targetCount - 1 : targetCount; + const paramCount = sourceRestType ? targetNonRestCount : Math.min(sourceCount, targetNonRestCount); const sourceThisType = getThisTypeOfSignature(source); if (sourceThisType) { const targetThisType = getThisTypeOfSignature(target); @@ -13900,15 +13907,17 @@ namespace ts { if (!inferredType) { const signature = context.signature; if (signature) { - if (inference.contraCandidates && (!inference.candidates || inference.candidates.length === 1 && inference.candidates[0].flags & TypeFlags.Never)) { - // If we have contravariant inferences, but no covariant inferences or a single - // covariant inference of 'never', we find the best common subtype and treat that - // as a single covariant candidate. - inference.candidates = [getContravariantInference(inference)]; - inference.contraCandidates = undefined; + const inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : undefined; + if (inference.contraCandidates) { + const inferredContravariantType = getContravariantInference(inference); + // If we have both co- and contra-variant inferences, we prefer the contra-variant inference + // unless the co-variant inference is a subtype and not 'never'. + inferredType = inferredCovariantType && !(inferredCovariantType.flags & TypeFlags.Never) && + isTypeSubtypeOf(inferredCovariantType, inferredContravariantType) ? + inferredCovariantType : inferredContravariantType; } - if (inference.candidates) { - inferredType = getCovariantInference(inference, signature); + else if (inferredCovariantType) { + inferredType = inferredCovariantType; } else if (context.flags & InferenceFlags.NoDefault) { // We use silentNeverType as the wildcard that signals no inferences. @@ -19684,7 +19693,10 @@ namespace ts { checkCandidate = candidate; } if (!checkApplicableSignature(node, args, checkCandidate, relation, excludeArgument, /*reportErrors*/ false)) { - candidateForArgumentError = checkCandidate; + // Give preference to error candidates that have no rest parameters (as they are more specific) + if (!candidateForArgumentError || getEffectiveRestType(candidateForArgumentError) || !getEffectiveRestType(checkCandidate)) { + candidateForArgumentError = checkCandidate; + } continue; } if (excludeArgument) { @@ -19697,7 +19709,10 @@ namespace ts { checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration)); } if (!checkApplicableSignature(node, args, checkCandidate, relation, excludeArgument, /*reportErrors*/ false)) { - candidateForArgumentError = checkCandidate; + // Give preference to error candidates that have no rest parameters (as they are more specific) + if (!candidateForArgumentError || getEffectiveRestType(candidateForArgumentError) || !getEffectiveRestType(checkCandidate)) { + candidateForArgumentError = checkCandidate; + } continue; } } @@ -28029,8 +28044,11 @@ namespace ts { function getAugmentedPropertiesOfType(type: Type): Symbol[] { type = getApparentType(type); const propsByName = createSymbolTable(getPropertiesOfType(type)); - if (typeHasCallOrConstructSignatures(type)) { - forEach(getPropertiesOfType(globalFunctionType), p => { + const functionType = getSignaturesOfType(type, SignatureKind.Call).length ? globalCallableFunctionType : + getSignaturesOfType(type, SignatureKind.Construct).length ? globalNewableFunctionType : + undefined; + if (functionType) { + forEach(getPropertiesOfType(functionType), p => { if (!propsByName.has(p.escapedName)) { propsByName.set(p.escapedName, p); } @@ -28810,6 +28828,8 @@ namespace ts { globalArrayType = getGlobalType("Array" as __String, /*arity*/ 1, /*reportErrors*/ true); globalObjectType = getGlobalType("Object" as __String, /*arity*/ 0, /*reportErrors*/ true); globalFunctionType = getGlobalType("Function" as __String, /*arity*/ 0, /*reportErrors*/ true); + globalCallableFunctionType = strictBindCallApply && getGlobalType("CallableFunction" as __String, /*arity*/ 0, /*reportErrors*/ true) || globalFunctionType; + globalNewableFunctionType = strictBindCallApply && getGlobalType("NewableFunction" as __String, /*arity*/ 0, /*reportErrors*/ true) || globalFunctionType; globalStringType = getGlobalType("String" as __String, /*arity*/ 0, /*reportErrors*/ true); globalNumberType = getGlobalType("Number" as __String, /*arity*/ 0, /*reportErrors*/ true); globalBooleanType = getGlobalType("Boolean" as __String, /*arity*/ 0, /*reportErrors*/ true); diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index dcf024f77a5..3ebb865a64c 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -373,6 +373,14 @@ namespace ts { category: Diagnostics.Strict_Type_Checking_Options, description: Diagnostics.Enable_strict_checking_of_function_types }, + { + name: "strictBindCallApply", + type: "boolean", + strictFlag: true, + showInSimplifiedHelpView: true, + category: Diagnostics.Strict_Type_Checking_Options, + description: Diagnostics.Enable_strict_bind_call_and_apply_methods_on_functions + }, { name: "strictPropertyInitialization", type: "boolean", diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 22fc19bcc8a..db18d8c9551 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1,7 +1,7 @@ namespace ts { // WARNING: The script `configureNightly.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configureNightly` too. - export const versionMajorMinor = "3.1"; + export const versionMajorMinor = "3.2"; /** The version of the TypeScript compiler release */ export const version = `${versionMajorMinor}.0-dev`; } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 706a3552765..ce1ccf17145 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3759,6 +3759,10 @@ "category": "Message", "code": 6213 }, + "Enable strict 'bind', 'call', and 'apply' methods on functions.": { + "category": "Message", + "code": 6214 + }, "Projects to reference": { "category": "Message", diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 176f259e074..97ef69d41e5 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4427,6 +4427,7 @@ namespace ts { sourceRoot?: string; strict?: boolean; strictFunctionTypes?: boolean; // Always combine with strict property + strictBindCallApply?: boolean; // Always combine with strict property strictNullChecks?: boolean; // Always combine with strict property strictPropertyInitialization?: boolean; // Always combine with strict property stripInternal?: boolean; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 00e35fb0a85..60a7d759b68 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -7085,7 +7085,7 @@ namespace ts { return !!(compilerOptions.declaration || compilerOptions.composite); } - export type StrictOptionName = "noImplicitAny" | "noImplicitThis" | "strictNullChecks" | "strictFunctionTypes" | "strictPropertyInitialization" | "alwaysStrict"; + export type StrictOptionName = "noImplicitAny" | "noImplicitThis" | "strictNullChecks" | "strictFunctionTypes" | "strictBindCallApply" | "strictPropertyInitialization" | "alwaysStrict"; export function getStrictOptionValue(compilerOptions: CompilerOptions, flag: StrictOptionName): boolean { return compilerOptions[flag] === undefined ? !!compilerOptions.strict : !!compilerOptions[flag]; diff --git a/src/harness/virtualFileSystemWithWatch.ts b/src/harness/virtualFileSystemWithWatch.ts index b85d5aa1c79..d2b7c7869c5 100644 --- a/src/harness/virtualFileSystemWithWatch.ts +++ b/src/harness/virtualFileSystemWithWatch.ts @@ -4,6 +4,8 @@ namespace ts.TestFSWithWatch { content: `/// interface Boolean {} interface Function {} +interface CallableFunction {} +interface NewableFunction {} interface IArguments {} interface Number { toExponential: any; } interface Object {} diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 015eec5c3e0..2917539cfdb 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -295,6 +295,66 @@ interface FunctionConstructor { declare const Function: FunctionConstructor; +interface CallableFunction extends Function { + /** + * Calls the function with the specified object as the this value and the elements of specified array as the arguments. + * @param thisArg The object to be used as the this object. + * @param args An array of argument values to be passed to the function. + */ + apply(this: (this: T) => R, thisArg: T): R; + apply(this: (this: T, ...args: A) => R, thisArg: T, args: A): R; + + /** + * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. + * @param thisArg The object to be used as the this object. + * @param args Argument values to be passed to the function. + */ + call(this: (this: T, ...args: A) => R, thisArg: T, ...args: A): R; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg The object to be used as the this object. + * @param args Arguments to bind to the parameters of the function. + */ + bind(this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; + bind(this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; + bind(this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; + bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; + bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; + bind(this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; +} + +interface NewableFunction extends Function { + /** + * Calls the function with the specified object as the this value and the elements of specified array as the arguments. + * @param thisArg The object to be used as the this object. + * @param args An array of argument values to be passed to the function. + */ + apply(this: new () => T, thisArg: T): void; + apply(this: new (...args: A) => T, thisArg: T, args: A): void; + + /** + * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. + * @param thisArg The object to be used as the this object. + * @param args Argument values to be passed to the function. + */ + call(this: new (...args: A) => T, thisArg: T, ...args: A): void; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg The object to be used as the this object. + * @param args Arguments to bind to the parameters of the function. + */ + bind(this: new (...args: A) => R, thisArg: any): new (...args: A) => R; + bind(this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; + bind(this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; + bind(this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; + bind(this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; + bind(this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; +} + interface IArguments { [index: number]: any; length: number; diff --git a/src/server/session.ts b/src/server/session.ts index 66b8cd6e284..dd9708c1ddf 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1167,8 +1167,8 @@ namespace ts.server { return { info: renameInfo, locs: this.toSpanGroups(locations) }; } - private mapRenameInfo({ canRename, localizedErrorMessage, displayName, fullDisplayName, kind, kindModifiers, triggerSpan }: RenameInfo, scriptInfo: ScriptInfo): protocol.RenameInfo { - return { canRename, localizedErrorMessage, displayName, fullDisplayName, kind, kindModifiers, triggerSpan: this.toLocationTextSpan(triggerSpan, scriptInfo) }; + private mapRenameInfo({ canRename, fileToRename, localizedErrorMessage, displayName, fullDisplayName, kind, kindModifiers, triggerSpan }: RenameInfo, scriptInfo: ScriptInfo): protocol.RenameInfo { + return { canRename, fileToRename, localizedErrorMessage, displayName, fullDisplayName, kind, kindModifiers, triggerSpan: this.toLocationTextSpan(triggerSpan, scriptInfo) }; } private toSpanGroups(locations: ReadonlyArray): ReadonlyArray { diff --git a/src/testRunner/unittests/tsserverProjectSystem.ts b/src/testRunner/unittests/tsserverProjectSystem.ts index 639cd657e0d..cb1b7f3983d 100644 --- a/src/testRunner/unittests/tsserverProjectSystem.ts +++ b/src/testRunner/unittests/tsserverProjectSystem.ts @@ -8294,6 +8294,7 @@ namespace ts.projectSystem { info: { canRename: true, displayName: "C", + fileToRename: undefined, fullDisplayName: '"/users/username/projects/a/c/fc".C', kind: ScriptElementKind.constElement, kindModifiers: ScriptElementKindModifier.exportedModifier, @@ -9462,8 +9463,7 @@ export function Test2() { content: "{}", }; - const host = createServerHost([aTs, bTs, tsconfig]); - const session = createSession(host); + const session = createSession(createServerHost([aTs, bTs, tsconfig])); openFilesForSession([aTs, bTs], session); const requestLocation: protocol.FileLocationRequestArgs = { @@ -9569,6 +9569,31 @@ export function Test2() { }); }); + describe("tsserverProjectSystem rename", () => { + it("works", () => { + const aTs: File = { path: "/a.ts", content: "export const a = 0;" }; + const bTs: File = { path: "/b.ts", content: 'import { a } from "./a";' }; + + const session = createSession(createServerHost([aTs, bTs])); + openFilesForSession([bTs], session); + + const response = executeSessionRequest(session, protocol.CommandTypes.Rename, protocolFileLocationFromSubstring(bTs, 'a";')); + assert.deepEqual(response, { + info: { + canRename: true, + fileToRename: aTs.path, + displayName: aTs.path, + fullDisplayName: aTs.path, + kind: ScriptElementKind.moduleElement, + kindModifiers: "", + localizedErrorMessage: undefined, + triggerSpan: protocolTextSpanFromSubstring(bTs.content, "a", { index: 1 }), + }, + locs: [{ file: bTs.path, locs: [protocolTextSpanFromSubstring(bTs.content, "./a")] }], + }); + }); + }); + describe("tsserverProjectSystem typeReferenceDirectives", () => { it("when typeReferenceDirective contains UpperCasePackage", () => { const projectLocation = "/user/username/projects/myproject"; @@ -10062,6 +10087,7 @@ declare class TestLib { info: { canRename: true, displayName: "fnA", + fileToRename: undefined, fullDisplayName: "fnA", kind: ScriptElementKind.alias, kindModifiers: ScriptElementKindModifier.none, @@ -10081,6 +10107,7 @@ declare class TestLib { info: { canRename: true, displayName: "fnA", + fileToRename: undefined, fullDisplayName: '"/a/a".fnA', kind: ScriptElementKind.functionElement, kindModifiers: ScriptElementKindModifier.exportedModifier, @@ -10110,6 +10137,7 @@ declare class TestLib { info: { canRename: true, displayName: "fnB", + fileToRename: undefined, fullDisplayName: "fnB", kind: ScriptElementKind.alias, kindModifiers: ScriptElementKindModifier.none, diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 68926b43c81..b71b3c90137 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "3.1"; + const versionMajorMinor = "3.2"; /** The version of the TypeScript compiler release */ const version: string; } @@ -2494,6 +2494,7 @@ declare namespace ts { sourceRoot?: string; strict?: boolean; strictFunctionTypes?: boolean; + strictBindCallApply?: boolean; strictNullChecks?: boolean; strictPropertyInitialization?: boolean; stripInternal?: boolean; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 4b01738783d..3a442e7f19c 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "3.1"; + const versionMajorMinor = "3.2"; /** The version of the TypeScript compiler release */ const version: string; } @@ -2494,6 +2494,7 @@ declare namespace ts { sourceRoot?: string; strict?: boolean; strictFunctionTypes?: boolean; + strictBindCallApply?: boolean; strictNullChecks?: boolean; strictPropertyInitialization?: boolean; stripInternal?: boolean; diff --git a/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.errors.txt b/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.errors.txt new file mode 100644 index 00000000000..5b8fb9b0ea8 --- /dev/null +++ b/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.errors.txt @@ -0,0 +1,31 @@ +error TS2318: Cannot find global type 'CallableFunction'. +error TS2318: Cannot find global type 'NewableFunction'. + + +!!! error TS2318: Cannot find global type 'CallableFunction'. +!!! error TS2318: Cannot find global type 'NewableFunction'. +==== tests/cases/compiler/booleanLiteralsContextuallyTypedFromUnion.tsx (0 errors) ==== + interface A { isIt: true; text: string; } + interface B { isIt: false; value: number; } + type C = A | B; + const isIt = Math.random() > 0.5; + const c: C = isIt ? { isIt, text: 'hey' } : { isIt, value: 123 }; + const cc: C = isIt ? { isIt: isIt, text: 'hey' } : { isIt: isIt, value: 123 }; + + type ComponentProps = + | { + optionalBool: true; + mandatoryFn: () => void; + } + | { + optionalBool: false; + }; + + let Funk = (_props: ComponentProps) =>
Hello
; + + let Fail1 = () => { }} optionalBool={true} /> + let Fail2 = () => { }} optionalBool={true as true} /> + let True = true as true; + let Fail3 = () => { }} optionalBool={True} /> + let attrs2 = { optionalBool: true as true, mandatoryFn: () => { } } + let Success = () => \ No newline at end of file diff --git a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt index d970223cb1c..ed6360bdd32 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt +++ b/tests/baselines/reference/destructuringParameterDeclaration4.errors.txt @@ -41,7 +41,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts( a1(...array2); // Error parameter type is (number|string)[] ~~~~~~ !!! error TS2552: Cannot find name 'array2'. Did you mean 'Array'? -!!! related TS2728 /.ts/lib.es5.d.ts:1298:15: 'Array' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:1358:15: 'Array' is declared here. a5([1, 2, "string", false, true]); // Error, parameter type is [any, any, [[any]]] ~~~~~~~~ !!! error TS2322: Type 'string' is not assignable to type '[[any]]'. diff --git a/tests/baselines/reference/enumTagUseBeforeDefCrash.symbols b/tests/baselines/reference/enumTagUseBeforeDefCrash.symbols new file mode 100644 index 00000000000..1cef96a9823 --- /dev/null +++ b/tests/baselines/reference/enumTagUseBeforeDefCrash.symbols @@ -0,0 +1,13 @@ +=== tests/cases/conformance/jsdoc/bug27134.js === +/** + * @enum {number} + */ +var foo = { }; +>foo : Symbol(foo, Decl(bug27134.js, 3, 3)) + +/** + * @type {foo} + */ +var s; +>s : Symbol(s, Decl(bug27134.js, 8, 3)) + diff --git a/tests/baselines/reference/enumTagUseBeforeDefCrash.types b/tests/baselines/reference/enumTagUseBeforeDefCrash.types new file mode 100644 index 00000000000..159781fee05 --- /dev/null +++ b/tests/baselines/reference/enumTagUseBeforeDefCrash.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/jsdoc/bug27134.js === +/** + * @enum {number} + */ +var foo = { }; +>foo : typeof foo +>{ } : {} + +/** + * @type {foo} + */ +var s; +>s : number + diff --git a/tests/baselines/reference/externModule.errors.txt b/tests/baselines/reference/externModule.errors.txt index 1ca359d5d1d..e1077550985 100644 --- a/tests/baselines/reference/externModule.errors.txt +++ b/tests/baselines/reference/externModule.errors.txt @@ -69,20 +69,20 @@ tests/cases/compiler/externModule.ts(37,3): error TS2552: Cannot find name 'XDat var d=new XDate(); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:837:15: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:897:15: 'Date' is declared here. d.getDay(); d=new XDate(1978,2); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:837:15: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:897:15: 'Date' is declared here. d.getXDate(); var n=XDate.parse("3/2/2004"); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:837:15: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:897:15: 'Date' is declared here. n=XDate.UTC(1964,2,1); ~~~~~ !!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'? -!!! related TS2728 /.ts/lib.es5.d.ts:837:15: 'Date' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:897:15: 'Date' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/genericRestArityStrict.errors.txt b/tests/baselines/reference/genericRestArityStrict.errors.txt index 9a77f8d8498..2803c6215e4 100644 --- a/tests/baselines/reference/genericRestArityStrict.errors.txt +++ b/tests/baselines/reference/genericRestArityStrict.errors.txt @@ -1,7 +1,8 @@ -tests/cases/conformance/types/rest/genericRestArityStrict.ts(7,6): error TS2345: Argument of type '(x: number, y: number) => number' is not assignable to parameter of type '() => void'. +tests/cases/conformance/types/rest/genericRestArityStrict.ts(7,1): error TS2554: Expected 3 arguments, but got 1. +tests/cases/conformance/types/rest/genericRestArityStrict.ts(8,1): error TS2554: Expected 3 arguments, but got 8. -==== tests/cases/conformance/types/rest/genericRestArityStrict.ts (1 errors) ==== +==== tests/cases/conformance/types/rest/genericRestArityStrict.ts (2 errors) ==== // Repro from #25559 declare function call( @@ -9,7 +10,10 @@ tests/cases/conformance/types/rest/genericRestArityStrict.ts(7,6): error TS2345: ...args: TS): void; call((x: number, y: number) => x + y); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(x: number, y: number) => number' is not assignable to parameter of type '() => void'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 3 arguments, but got 1. +!!! related TS6210 tests/cases/conformance/types/rest/genericRestArityStrict.ts:5:5: An argument for 'args' was not provided. call((x: number, y: number) => x + y, 1, 2, 3, 4, 5, 6, 7); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 3 arguments, but got 8. \ No newline at end of file diff --git a/tests/baselines/reference/genericRestArityStrict.types b/tests/baselines/reference/genericRestArityStrict.types index afdcbb2df0d..0bdf6d0e96d 100644 --- a/tests/baselines/reference/genericRestArityStrict.types +++ b/tests/baselines/reference/genericRestArityStrict.types @@ -22,7 +22,7 @@ call((x: number, y: number) => x + y); >y : number call((x: number, y: number) => x + y, 1, 2, 3, 4, 5, 6, 7); ->call((x: number, y: number) => x + y, 1, 2, 3, 4, 5, 6, 7) : void +>call((x: number, y: number) => x + y, 1, 2, 3, 4, 5, 6, 7) : any >call : (handler: (...args: TS) => void, ...args: TS) => void >(x: number, y: number) => x + y : (x: number, y: number) => number >x : number diff --git a/tests/baselines/reference/jsxChildrenGenericContextualTypes.errors.txt b/tests/baselines/reference/jsxChildrenGenericContextualTypes.errors.txt index fca81df6a6a..844459e5f95 100644 --- a/tests/baselines/reference/jsxChildrenGenericContextualTypes.errors.txt +++ b/tests/baselines/reference/jsxChildrenGenericContextualTypes.errors.txt @@ -1,13 +1,9 @@ tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(20,46): error TS2322: Type '"y"' is not assignable to type '"x"'. -tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(21,19): error TS2322: Type '{ children: (p: LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x" | "y">'. - Type '{ children: (p: LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'LitProps<"x" | "y">'. +tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(21,19): error TS2322: Type '{ children: (p: LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x">'. + Type '{ children: (p: LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'LitProps<"x">'. Types of property 'children' are incompatible. - Type '(p: LitProps<"x">) => "y"' is not assignable to type '(x: LitProps<"x" | "y">) => "x" | "y"'. - Types of parameters 'p' and 'x' are incompatible. - Type 'LitProps<"x" | "y">' is not assignable to type 'LitProps<"x">'. - Types of property 'prop' are incompatible. - Type '"x" | "y"' is not assignable to type '"x"'. - Type '"y"' is not assignable to type '"x"'. + Type '(p: LitProps<"x">) => "y"' is not assignable to type '(x: LitProps<"x">) => "x"'. + Type '"y"' is not assignable to type '"x"'. tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(22,21): error TS2322: Type '{ children: () => number; prop: "x"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x">'. Type '{ children: () => number; prop: "x"; }' is not assignable to type 'LitProps<"x">'. Types of property 'children' are incompatible. @@ -41,15 +37,11 @@ tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx(22,21): error TS2322: !!! related TS6502 tests/cases/compiler/jsxChildrenGenericContextualTypes.tsx:13:44: The expected type comes from the return type of this signature. const argchild = {p => "y"} ~~~~~~~ -!!! error TS2322: Type '{ children: (p: LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x" | "y">'. -!!! error TS2322: Type '{ children: (p: LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'LitProps<"x" | "y">'. +!!! error TS2322: Type '{ children: (p: LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x">'. +!!! error TS2322: Type '{ children: (p: LitProps<"x">) => "y"; prop: "x"; }' is not assignable to type 'LitProps<"x">'. !!! error TS2322: Types of property 'children' are incompatible. -!!! error TS2322: Type '(p: LitProps<"x">) => "y"' is not assignable to type '(x: LitProps<"x" | "y">) => "x" | "y"'. -!!! error TS2322: Types of parameters 'p' and 'x' are incompatible. -!!! error TS2322: Type 'LitProps<"x" | "y">' is not assignable to type 'LitProps<"x">'. -!!! error TS2322: Types of property 'prop' are incompatible. -!!! error TS2322: Type '"x" | "y"' is not assignable to type '"x"'. -!!! error TS2322: Type '"y"' is not assignable to type '"x"'. +!!! error TS2322: Type '(p: LitProps<"x">) => "y"' is not assignable to type '(x: LitProps<"x">) => "x"'. +!!! error TS2322: Type '"y"' is not assignable to type '"x"'. const mismatched = {() => 12} ~~~~~~~ !!! error TS2322: Type '{ children: () => number; prop: "x"; }' is not assignable to type 'IntrinsicAttributes & LitProps<"x">'. diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt index 35e0e0fb1ab..f2c77d62984 100644 --- a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt @@ -41,7 +41,7 @@ tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.t Math.sign(1); ~~~~ !!! error TS2551: Property 'sign' does not exist on type 'Math'. Did you mean 'sin'? -!!! related TS2728 /.ts/lib.es5.d.ts:643:5: 'sin' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:703:5: 'sin' is declared here. // Using ES6 object var o = { diff --git a/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt b/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt index 699b65a4f64..12b2790c3de 100644 --- a/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt +++ b/tests/baselines/reference/narrowExceptionVariableInCatchClause.errors.txt @@ -24,7 +24,7 @@ tests/cases/conformance/types/any/narrowExceptionVariableInCatchClause.ts(16,17) err.massage; // ERROR: Property 'massage' does not exist on type 'Error' ~~~~~~~ !!! error TS2551: Property 'massage' does not exist on type 'Error'. Did you mean 'message'? -!!! related TS2728 /.ts/lib.es5.d.ts:904:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:964:5: 'message' is declared here. } else { diff --git a/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt b/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt index 216211b2fa2..f5c0c5728f1 100644 --- a/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt +++ b/tests/baselines/reference/narrowFromAnyWithInstanceof.errors.txt @@ -22,7 +22,7 @@ tests/cases/conformance/types/any/narrowFromAnyWithInstanceof.ts(22,7): error TS x.mesage; ~~~~~~ !!! error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'? -!!! related TS2728 /.ts/lib.es5.d.ts:904:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:964:5: 'message' is declared here. } if (x instanceof Date) { @@ -30,6 +30,6 @@ tests/cases/conformance/types/any/narrowFromAnyWithInstanceof.ts(22,7): error TS x.getHuors(); ~~~~~~~~ !!! error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'? -!!! related TS2728 /.ts/lib.es5.d.ts:693:5: 'getHours' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:753:5: 'getHours' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt b/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt index c35d3263b8f..385357f2204 100644 --- a/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt +++ b/tests/baselines/reference/narrowFromAnyWithTypePredicate.errors.txt @@ -39,7 +39,7 @@ tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(33,7): error x.mesage; ~~~~~~ !!! error TS2551: Property 'mesage' does not exist on type 'Error'. Did you mean 'message'? -!!! related TS2728 /.ts/lib.es5.d.ts:904:5: 'message' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:964:5: 'message' is declared here. } if (isDate(x)) { @@ -47,6 +47,6 @@ tests/cases/conformance/types/any/narrowFromAnyWithTypePredicate.ts(33,7): error x.getHuors(); ~~~~~~~~ !!! error TS2551: Property 'getHuors' does not exist on type 'Date'. Did you mean 'getHours'? -!!! related TS2728 /.ts/lib.es5.d.ts:693:5: 'getHours' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:753:5: 'getHours' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt b/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt index d0db1597607..bd7db9c44fe 100644 --- a/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt +++ b/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.errors.txt @@ -11,4 +11,4 @@ tests/cases/conformance/parser/ecmascript5/Expressions/parserMemberAccessAfterPo !!! error TS1005: ';' expected. ~~~~~~~~ !!! error TS2552: Cannot find name 'toString'. Did you mean 'String'? -!!! related TS2728 /.ts/lib.es5.d.ts:457:15: 'String' is declared here. \ No newline at end of file +!!! related TS2728 /.ts/lib.es5.d.ts:517:15: 'String' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt b/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt index 16a1a9c5ff2..136d4477268 100644 --- a/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt +++ b/tests/baselines/reference/parserS7.2_A1.5_T2.errors.txt @@ -19,7 +19,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.2_A1.5_T2.ts(20,3): error TS $ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } //CHECK#2 @@ -28,7 +28,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.2_A1.5_T2.ts(20,3): error TS $ERROR('#2:  var x = 1 ; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } diff --git a/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt b/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt index a644e1b6f0d..3a35d5f0a83 100644 --- a/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt +++ b/tests/baselines/reference/parserS7.3_A1.1_T2.errors.txt @@ -21,7 +21,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.3_A1.1_T2.ts(17,3): error TS $ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt b/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt index f29839f43c1..35fc8935b73 100644 --- a/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt +++ b/tests/baselines/reference/parserS7.6_A4.2_T1.errors.txt @@ -50,70 +50,70 @@ tests/cases/conformance/parser/ecmascript5/parserS7.6_A4.2_T1.ts(142,3): error T $ERROR('#А'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0411 = 1; if (Б !== 1) { $ERROR('#Б'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0412 = 1; if (В !== 1) { $ERROR('#В'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0413 = 1; if (Г !== 1) { $ERROR('#Г'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0414 = 1; if (Д !== 1) { $ERROR('#Д'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0415 = 1; if (Е !== 1) { $ERROR('#Е'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0416 = 1; if (Ж !== 1) { $ERROR('#Ж'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0417 = 1; if (З !== 1) { $ERROR('#З'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0418 = 1; if (И !== 1) { $ERROR('#И'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0419 = 1; if (Й !== 1) { $ERROR('#Й'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u041A = 1; if (К !== 1) { diff --git a/tests/baselines/reference/parserUnicode1.errors.txt b/tests/baselines/reference/parserUnicode1.errors.txt index 803119cc3e7..2e16f696620 100644 --- a/tests/baselines/reference/parserUnicode1.errors.txt +++ b/tests/baselines/reference/parserUnicode1.errors.txt @@ -11,13 +11,13 @@ tests/cases/conformance/parser/ecmascript5/parserUnicode1.ts(10,5): error TS2552 $ERROR('#6.1: var \\u0078x = 1; xx === 6. Actual: ' + (xx)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } } catch (e) { $ERROR('#6.2: var \\u0078x = 1; xx === 6. Actual: ' + (xx)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/promiseTypeInference.errors.txt b/tests/baselines/reference/promiseTypeInference.errors.txt index 0ae42f3cbbd..5edf8f5b091 100644 --- a/tests/baselines/reference/promiseTypeInference.errors.txt +++ b/tests/baselines/reference/promiseTypeInference.errors.txt @@ -26,5 +26,5 @@ tests/cases/compiler/promiseTypeInference.ts(10,39): error TS2322: Type 'IPromis !!! error TS2322: Types of parameters 'success' and 'onfulfilled' are incompatible. !!! error TS2322: Type 'TResult1 | PromiseLike' is not assignable to type 'IPromise'. !!! error TS2322: Type 'TResult1' is not assignable to type 'IPromise'. -!!! related TS6502 /.ts/lib.es5.d.ts:1336:57: The expected type comes from the return type of this signature. +!!! related TS6502 /.ts/lib.es5.d.ts:1396:57: The expected type comes from the return type of this signature. \ No newline at end of file diff --git a/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt b/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt index da25f2199cf..f61392a51ec 100644 --- a/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt +++ b/tests/baselines/reference/scannerS7.2_A1.5_T2.errors.txt @@ -19,7 +19,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.2_A1.5_T2.ts(20,3): error $ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } //CHECK#2 @@ -28,7 +28,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.2_A1.5_T2.ts(20,3): error $ERROR('#2:  var x = 1 ; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } diff --git a/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt b/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt index 4bfaf868f6d..f7ab44d83d5 100644 --- a/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt +++ b/tests/baselines/reference/scannerS7.3_A1.1_T2.errors.txt @@ -21,7 +21,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.3_A1.1_T2.ts(17,3): error $ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x)); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt b/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt index 1ff3ea85676..ab3bddb5bc6 100644 --- a/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt +++ b/tests/baselines/reference/scannerS7.6_A4.2_T1.errors.txt @@ -50,70 +50,70 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.6_A4.2_T1.ts(142,3): error $ERROR('#А'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0411 = 1; if (Б !== 1) { $ERROR('#Б'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0412 = 1; if (В !== 1) { $ERROR('#В'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0413 = 1; if (Г !== 1) { $ERROR('#Г'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0414 = 1; if (Д !== 1) { $ERROR('#Д'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0415 = 1; if (Е !== 1) { $ERROR('#Е'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0416 = 1; if (Ж !== 1) { $ERROR('#Ж'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0417 = 1; if (З !== 1) { $ERROR('#З'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0418 = 1; if (И !== 1) { $ERROR('#И'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u0419 = 1; if (Й !== 1) { $ERROR('#Й'); ~~~~~~ !!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'? -!!! related TS2728 /.ts/lib.es5.d.ts:914:15: 'Error' is declared here. +!!! related TS2728 /.ts/lib.es5.d.ts:974:15: 'Error' is declared here. } var \u041A = 1; if (К !== 1) { diff --git a/tests/baselines/reference/strictBindCallApply1.errors.txt b/tests/baselines/reference/strictBindCallApply1.errors.txt new file mode 100644 index 00000000000..e998238a8f7 --- /dev/null +++ b/tests/baselines/reference/strictBindCallApply1.errors.txt @@ -0,0 +1,139 @@ +tests/cases/conformance/functions/strictBindCallApply1.ts(6,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(9,11): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(10,35): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(11,11): error TS2554: Expected 3 arguments, but got 4. +tests/cases/conformance/functions/strictBindCallApply1.ts(14,32): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. + Property '1' is missing in type '[number]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(15,37): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(16,32): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. + Types of property 'length' are incompatible. + Type '3' is not assignable to type '2'. +tests/cases/conformance/functions/strictBindCallApply1.ts(29,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(30,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. +tests/cases/conformance/functions/strictBindCallApply1.ts(33,11): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(34,29): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(35,11): error TS2554: Expected 3 arguments, but got 4. +tests/cases/conformance/functions/strictBindCallApply1.ts(36,22): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. +tests/cases/conformance/functions/strictBindCallApply1.ts(39,26): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(40,31): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(41,26): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(42,23): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. +tests/cases/conformance/functions/strictBindCallApply1.ts(47,33): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(50,1): error TS2554: Expected 3 arguments, but got 2. +tests/cases/conformance/functions/strictBindCallApply1.ts(51,15): error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(52,1): error TS2554: Expected 3 arguments, but got 4. +tests/cases/conformance/functions/strictBindCallApply1.ts(55,12): error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +tests/cases/conformance/functions/strictBindCallApply1.ts(56,17): error TS2322: Type 'number' is not assignable to type 'string'. +tests/cases/conformance/functions/strictBindCallApply1.ts(57,12): error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. + + +==== tests/cases/conformance/functions/strictBindCallApply1.ts (24 errors) ==== + declare function foo(a: number, b: string): string; + + let f00 = foo.bind(undefined); + let f01 = foo.bind(undefined, 10); + let f02 = foo.bind(undefined, 10, "hello"); + let f03 = foo.bind(undefined, 10, 20); // Error + ~~ +!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + + let c00 = foo.call(undefined, 10, "hello"); + let c01 = foo.call(undefined, 10); // Error + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 3 arguments, but got 2. + let c02 = foo.call(undefined, 10, 20); // Error + ~~ +!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + let c03 = foo.call(undefined, 10, "hello", 30); // Error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 3 arguments, but got 4. + + let a00 = foo.apply(undefined, [10, "hello"]); + let a01 = foo.apply(undefined, [10]); // Error + ~~~~ +!!! error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. +!!! error TS2345: Property '1' is missing in type '[number]'. + let a02 = foo.apply(undefined, [10, 20]); // Error + ~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + let a03 = foo.apply(undefined, [10, "hello", 30]); // Error + ~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. +!!! error TS2345: Types of property 'length' are incompatible. +!!! error TS2345: Type '3' is not assignable to type '2'. + + class C { + constructor(a: number, b: string) {} + foo(this: this, a: number, b: string): string { return "" } + } + + declare let c: C; + declare let obj: {}; + + let f10 = c.foo.bind(c); + let f11 = c.foo.bind(c, 10); + let f12 = c.foo.bind(c, 10, "hello"); + let f13 = c.foo.bind(c, 10, 20); // Error + ~~ +!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + let f14 = c.foo.bind(undefined); // Error + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. + + let c10 = c.foo.call(c, 10, "hello"); + let c11 = c.foo.call(c, 10); // Error + ~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 3 arguments, but got 2. + let c12 = c.foo.call(c, 10, 20); // Error + ~~ +!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + let c13 = c.foo.call(c, 10, "hello", 30); // Error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 3 arguments, but got 4. + let c14 = c.foo.call(undefined, 10, "hello"); // Error + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. + + let a10 = c.foo.apply(c, [10, "hello"]); + let a11 = c.foo.apply(c, [10]); // Error + ~~~~ +!!! error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. + let a12 = c.foo.apply(c, [10, 20]); // Error + ~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + let a13 = c.foo.apply(c, [10, "hello", 30]); // Error + ~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. + let a14 = c.foo.apply(undefined, [10, "hello"]); // Error + ~~~~~~~~~ +!!! error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'C'. + + let f20 = C.bind(undefined); + let f21 = C.bind(undefined, 10); + let f22 = C.bind(undefined, 10, "hello"); + let f23 = C.bind(undefined, 10, 20); // Error + ~~ +!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + + C.call(c, 10, "hello"); + C.call(c, 10); // Error + ~~~~~~~~~~~~~ +!!! error TS2554: Expected 3 arguments, but got 2. + C.call(c, 10, 20); // Error + ~~ +!!! error TS2345: Argument of type '20' is not assignable to parameter of type 'string'. + C.call(c, 10, "hello", 30); // Error + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2554: Expected 3 arguments, but got 4. + + C.apply(c, [10, "hello"]); + C.apply(c, [10]); // Error + ~~~~ +!!! error TS2345: Argument of type '[number]' is not assignable to parameter of type '[number, string]'. + C.apply(c, [10, 20]); // Error + ~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + C.apply(c, [10, "hello", 30]); // Error + ~~~~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '[number, string, number]' is not assignable to parameter of type '[number, string]'. + \ No newline at end of file diff --git a/tests/baselines/reference/strictBindCallApply1.js b/tests/baselines/reference/strictBindCallApply1.js new file mode 100644 index 00000000000..e43c84edbf1 --- /dev/null +++ b/tests/baselines/reference/strictBindCallApply1.js @@ -0,0 +1,107 @@ +//// [strictBindCallApply1.ts] +declare function foo(a: number, b: string): string; + +let f00 = foo.bind(undefined); +let f01 = foo.bind(undefined, 10); +let f02 = foo.bind(undefined, 10, "hello"); +let f03 = foo.bind(undefined, 10, 20); // Error + +let c00 = foo.call(undefined, 10, "hello"); +let c01 = foo.call(undefined, 10); // Error +let c02 = foo.call(undefined, 10, 20); // Error +let c03 = foo.call(undefined, 10, "hello", 30); // Error + +let a00 = foo.apply(undefined, [10, "hello"]); +let a01 = foo.apply(undefined, [10]); // Error +let a02 = foo.apply(undefined, [10, 20]); // Error +let a03 = foo.apply(undefined, [10, "hello", 30]); // Error + +class C { + constructor(a: number, b: string) {} + foo(this: this, a: number, b: string): string { return "" } +} + +declare let c: C; +declare let obj: {}; + +let f10 = c.foo.bind(c); +let f11 = c.foo.bind(c, 10); +let f12 = c.foo.bind(c, 10, "hello"); +let f13 = c.foo.bind(c, 10, 20); // Error +let f14 = c.foo.bind(undefined); // Error + +let c10 = c.foo.call(c, 10, "hello"); +let c11 = c.foo.call(c, 10); // Error +let c12 = c.foo.call(c, 10, 20); // Error +let c13 = c.foo.call(c, 10, "hello", 30); // Error +let c14 = c.foo.call(undefined, 10, "hello"); // Error + +let a10 = c.foo.apply(c, [10, "hello"]); +let a11 = c.foo.apply(c, [10]); // Error +let a12 = c.foo.apply(c, [10, 20]); // Error +let a13 = c.foo.apply(c, [10, "hello", 30]); // Error +let a14 = c.foo.apply(undefined, [10, "hello"]); // Error + +let f20 = C.bind(undefined); +let f21 = C.bind(undefined, 10); +let f22 = C.bind(undefined, 10, "hello"); +let f23 = C.bind(undefined, 10, 20); // Error + +C.call(c, 10, "hello"); +C.call(c, 10); // Error +C.call(c, 10, 20); // Error +C.call(c, 10, "hello", 30); // Error + +C.apply(c, [10, "hello"]); +C.apply(c, [10]); // Error +C.apply(c, [10, 20]); // Error +C.apply(c, [10, "hello", 30]); // Error + + +//// [strictBindCallApply1.js] +"use strict"; +var f00 = foo.bind(undefined); +var f01 = foo.bind(undefined, 10); +var f02 = foo.bind(undefined, 10, "hello"); +var f03 = foo.bind(undefined, 10, 20); // Error +var c00 = foo.call(undefined, 10, "hello"); +var c01 = foo.call(undefined, 10); // Error +var c02 = foo.call(undefined, 10, 20); // Error +var c03 = foo.call(undefined, 10, "hello", 30); // Error +var a00 = foo.apply(undefined, [10, "hello"]); +var a01 = foo.apply(undefined, [10]); // Error +var a02 = foo.apply(undefined, [10, 20]); // Error +var a03 = foo.apply(undefined, [10, "hello", 30]); // Error +var C = /** @class */ (function () { + function C(a, b) { + } + C.prototype.foo = function (a, b) { return ""; }; + return C; +}()); +var f10 = c.foo.bind(c); +var f11 = c.foo.bind(c, 10); +var f12 = c.foo.bind(c, 10, "hello"); +var f13 = c.foo.bind(c, 10, 20); // Error +var f14 = c.foo.bind(undefined); // Error +var c10 = c.foo.call(c, 10, "hello"); +var c11 = c.foo.call(c, 10); // Error +var c12 = c.foo.call(c, 10, 20); // Error +var c13 = c.foo.call(c, 10, "hello", 30); // Error +var c14 = c.foo.call(undefined, 10, "hello"); // Error +var a10 = c.foo.apply(c, [10, "hello"]); +var a11 = c.foo.apply(c, [10]); // Error +var a12 = c.foo.apply(c, [10, 20]); // Error +var a13 = c.foo.apply(c, [10, "hello", 30]); // Error +var a14 = c.foo.apply(undefined, [10, "hello"]); // Error +var f20 = C.bind(undefined); +var f21 = C.bind(undefined, 10); +var f22 = C.bind(undefined, 10, "hello"); +var f23 = C.bind(undefined, 10, 20); // Error +C.call(c, 10, "hello"); +C.call(c, 10); // Error +C.call(c, 10, 20); // Error +C.call(c, 10, "hello", 30); // Error +C.apply(c, [10, "hello"]); +C.apply(c, [10]); // Error +C.apply(c, [10, 20]); // Error +C.apply(c, [10, "hello", 30]); // Error diff --git a/tests/baselines/reference/strictBindCallApply1.symbols b/tests/baselines/reference/strictBindCallApply1.symbols new file mode 100644 index 00000000000..b8133a65a78 --- /dev/null +++ b/tests/baselines/reference/strictBindCallApply1.symbols @@ -0,0 +1,322 @@ +=== tests/cases/conformance/functions/strictBindCallApply1.ts === +declare function foo(a: number, b: string): string; +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>a : Symbol(a, Decl(strictBindCallApply1.ts, 0, 21)) +>b : Symbol(b, Decl(strictBindCallApply1.ts, 0, 31)) + +let f00 = foo.bind(undefined); +>f00 : Symbol(f00, Decl(strictBindCallApply1.ts, 2, 3)) +>foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>undefined : Symbol(undefined) + +let f01 = foo.bind(undefined, 10); +>f01 : Symbol(f01, Decl(strictBindCallApply1.ts, 3, 3)) +>foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>undefined : Symbol(undefined) + +let f02 = foo.bind(undefined, 10, "hello"); +>f02 : Symbol(f02, Decl(strictBindCallApply1.ts, 4, 3)) +>foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>undefined : Symbol(undefined) + +let f03 = foo.bind(undefined, 10, 20); // Error +>f03 : Symbol(f03, Decl(strictBindCallApply1.ts, 5, 3)) +>foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>undefined : Symbol(undefined) + +let c00 = foo.call(undefined, 10, "hello"); +>c00 : Symbol(c00, Decl(strictBindCallApply1.ts, 7, 3)) +>foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let c01 = foo.call(undefined, 10); // Error +>c01 : Symbol(c01, Decl(strictBindCallApply1.ts, 8, 3)) +>foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let c02 = foo.call(undefined, 10, 20); // Error +>c02 : Symbol(c02, Decl(strictBindCallApply1.ts, 9, 3)) +>foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let c03 = foo.call(undefined, 10, "hello", 30); // Error +>c03 : Symbol(c03, Decl(strictBindCallApply1.ts, 10, 3)) +>foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let a00 = foo.apply(undefined, [10, "hello"]); +>a00 : Symbol(a00, Decl(strictBindCallApply1.ts, 12, 3)) +>foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let a01 = foo.apply(undefined, [10]); // Error +>a01 : Symbol(a01, Decl(strictBindCallApply1.ts, 13, 3)) +>foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let a02 = foo.apply(undefined, [10, 20]); // Error +>a02 : Symbol(a02, Decl(strictBindCallApply1.ts, 14, 3)) +>foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let a03 = foo.apply(undefined, [10, "hello", 30]); // Error +>a03 : Symbol(a03, Decl(strictBindCallApply1.ts, 15, 3)) +>foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo : Symbol(foo, Decl(strictBindCallApply1.ts, 0, 0)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +class C { +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) + + constructor(a: number, b: string) {} +>a : Symbol(a, Decl(strictBindCallApply1.ts, 18, 16)) +>b : Symbol(b, Decl(strictBindCallApply1.ts, 18, 26)) + + foo(this: this, a: number, b: string): string { return "" } +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>this : Symbol(this, Decl(strictBindCallApply1.ts, 19, 8)) +>a : Symbol(a, Decl(strictBindCallApply1.ts, 19, 19)) +>b : Symbol(b, Decl(strictBindCallApply1.ts, 19, 30)) +} + +declare let c: C; +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) + +declare let obj: {}; +>obj : Symbol(obj, Decl(strictBindCallApply1.ts, 23, 11)) + +let f10 = c.foo.bind(c); +>f10 : Symbol(f10, Decl(strictBindCallApply1.ts, 25, 3)) +>c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let f11 = c.foo.bind(c, 10); +>f11 : Symbol(f11, Decl(strictBindCallApply1.ts, 26, 3)) +>c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let f12 = c.foo.bind(c, 10, "hello"); +>f12 : Symbol(f12, Decl(strictBindCallApply1.ts, 27, 3)) +>c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let f13 = c.foo.bind(c, 10, 20); // Error +>f13 : Symbol(f13, Decl(strictBindCallApply1.ts, 28, 3)) +>c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let f14 = c.foo.bind(undefined); // Error +>f14 : Symbol(f14, Decl(strictBindCallApply1.ts, 29, 3)) +>c.foo.bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>bind : Symbol(CallableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>undefined : Symbol(undefined) + +let c10 = c.foo.call(c, 10, "hello"); +>c10 : Symbol(c10, Decl(strictBindCallApply1.ts, 31, 3)) +>c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let c11 = c.foo.call(c, 10); // Error +>c11 : Symbol(c11, Decl(strictBindCallApply1.ts, 32, 3)) +>c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let c12 = c.foo.call(c, 10, 20); // Error +>c12 : Symbol(c12, Decl(strictBindCallApply1.ts, 33, 3)) +>c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let c13 = c.foo.call(c, 10, "hello", 30); // Error +>c13 : Symbol(c13, Decl(strictBindCallApply1.ts, 34, 3)) +>c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let c14 = c.foo.call(undefined, 10, "hello"); // Error +>c14 : Symbol(c14, Decl(strictBindCallApply1.ts, 35, 3)) +>c.foo.call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>call : Symbol(CallableFunction.call, Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let a10 = c.foo.apply(c, [10, "hello"]); +>a10 : Symbol(a10, Decl(strictBindCallApply1.ts, 37, 3)) +>c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let a11 = c.foo.apply(c, [10]); // Error +>a11 : Symbol(a11, Decl(strictBindCallApply1.ts, 38, 3)) +>c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let a12 = c.foo.apply(c, [10, 20]); // Error +>a12 : Symbol(a12, Decl(strictBindCallApply1.ts, 39, 3)) +>c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let a13 = c.foo.apply(c, [10, "hello", 30]); // Error +>a13 : Symbol(a13, Decl(strictBindCallApply1.ts, 40, 3)) +>c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +let a14 = c.foo.apply(undefined, [10, "hello"]); // Error +>a14 : Symbol(a14, Decl(strictBindCallApply1.ts, 41, 3)) +>c.foo.apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c.foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) +>foo : Symbol(C.foo, Decl(strictBindCallApply1.ts, 18, 40)) +>apply : Symbol(CallableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>undefined : Symbol(undefined) + +let f20 = C.bind(undefined); +>f20 : Symbol(f20, Decl(strictBindCallApply1.ts, 43, 3)) +>C.bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>undefined : Symbol(undefined) + +let f21 = C.bind(undefined, 10); +>f21 : Symbol(f21, Decl(strictBindCallApply1.ts, 44, 3)) +>C.bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>undefined : Symbol(undefined) + +let f22 = C.bind(undefined, 10, "hello"); +>f22 : Symbol(f22, Decl(strictBindCallApply1.ts, 45, 3)) +>C.bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>undefined : Symbol(undefined) + +let f23 = C.bind(undefined, 10, 20); // Error +>f23 : Symbol(f23, Decl(strictBindCallApply1.ts, 46, 3)) +>C.bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>bind : Symbol(NewableFunction.bind, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>undefined : Symbol(undefined) + +C.call(c, 10, "hello"); +>C.call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +C.call(c, 10); // Error +>C.call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +C.call(c, 10, 20); // Error +>C.call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +C.call(c, 10, "hello", 30); // Error +>C.call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>call : Symbol(NewableFunction.call, Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +C.apply(c, [10, "hello"]); +>C.apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +C.apply(c, [10]); // Error +>C.apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +C.apply(c, [10, 20]); // Error +>C.apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + +C.apply(c, [10, "hello", 30]); // Error +>C.apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>C : Symbol(C, Decl(strictBindCallApply1.ts, 15, 50)) +>apply : Symbol(NewableFunction.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>c : Symbol(c, Decl(strictBindCallApply1.ts, 22, 11)) + diff --git a/tests/baselines/reference/strictBindCallApply1.types b/tests/baselines/reference/strictBindCallApply1.types new file mode 100644 index 00000000000..a895447e182 --- /dev/null +++ b/tests/baselines/reference/strictBindCallApply1.types @@ -0,0 +1,441 @@ +=== tests/cases/conformance/functions/strictBindCallApply1.ts === +declare function foo(a: number, b: string): string; +>foo : (a: number, b: string) => string +>a : number +>b : string + +let f00 = foo.bind(undefined); +>f00 : (a: number, b: string) => string +>foo.bind(undefined) : (a: number, b: string) => string +>foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>foo : (a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>undefined : undefined + +let f01 = foo.bind(undefined, 10); +>f01 : (b: string) => string +>foo.bind(undefined, 10) : (b: string) => string +>foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>foo : (a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>undefined : undefined +>10 : 10 + +let f02 = foo.bind(undefined, 10, "hello"); +>f02 : () => string +>foo.bind(undefined, 10, "hello") : () => string +>foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>foo : (a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>undefined : undefined +>10 : 10 +>"hello" : "hello" + +let f03 = foo.bind(undefined, 10, 20); // Error +>f03 : any +>foo.bind(undefined, 10, 20) : any +>foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>foo : (a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>undefined : undefined +>10 : 10 +>20 : 20 + +let c00 = foo.call(undefined, 10, "hello"); +>c00 : string +>foo.call(undefined, 10, "hello") : string +>foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>foo : (a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>undefined : undefined +>10 : 10 +>"hello" : "hello" + +let c01 = foo.call(undefined, 10); // Error +>c01 : any +>foo.call(undefined, 10) : any +>foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>foo : (a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>undefined : undefined +>10 : 10 + +let c02 = foo.call(undefined, 10, 20); // Error +>c02 : any +>foo.call(undefined, 10, 20) : any +>foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>foo : (a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>undefined : undefined +>10 : 10 +>20 : 20 + +let c03 = foo.call(undefined, 10, "hello", 30); // Error +>c03 : any +>foo.call(undefined, 10, "hello", 30) : any +>foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>foo : (a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>undefined : undefined +>10 : 10 +>"hello" : "hello" +>30 : 30 + +let a00 = foo.apply(undefined, [10, "hello"]); +>a00 : string +>foo.apply(undefined, [10, "hello"]) : string +>foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>foo : (a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>undefined : undefined +>[10, "hello"] : [number, string] +>10 : 10 +>"hello" : "hello" + +let a01 = foo.apply(undefined, [10]); // Error +>a01 : any +>foo.apply(undefined, [10]) : any +>foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>foo : (a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>undefined : undefined +>[10] : number[] +>10 : 10 + +let a02 = foo.apply(undefined, [10, 20]); // Error +>a02 : any +>foo.apply(undefined, [10, 20]) : any +>foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>foo : (a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>undefined : undefined +>[10, 20] : number[] +>10 : 10 +>20 : 20 + +let a03 = foo.apply(undefined, [10, "hello", 30]); // Error +>a03 : any +>foo.apply(undefined, [10, "hello", 30]) : any +>foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>foo : (a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>undefined : undefined +>[10, "hello", 30] : (string | number)[] +>10 : 10 +>"hello" : "hello" +>30 : 30 + +class C { +>C : C + + constructor(a: number, b: string) {} +>a : number +>b : string + + foo(this: this, a: number, b: string): string { return "" } +>foo : (this: this, a: number, b: string) => string +>this : this +>a : number +>b : string +>"" : "" +} + +declare let c: C; +>c : C + +declare let obj: {}; +>obj : {} + +let f10 = c.foo.bind(c); +>f10 : (a: number, b: string) => string +>c.foo.bind(c) : (a: number, b: string) => string +>c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c : C + +let f11 = c.foo.bind(c, 10); +>f11 : (b: string) => string +>c.foo.bind(c, 10) : (b: string) => string +>c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c : C +>10 : 10 + +let f12 = c.foo.bind(c, 10, "hello"); +>f12 : () => string +>c.foo.bind(c, 10, "hello") : () => string +>c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c : C +>10 : 10 +>"hello" : "hello" + +let f13 = c.foo.bind(c, 10, 20); // Error +>f13 : any +>c.foo.bind(c, 10, 20) : any +>c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c : C +>10 : 10 +>20 : 20 + +let f14 = c.foo.bind(undefined); // Error +>f14 : any +>c.foo.bind(undefined) : any +>c.foo.bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>bind : { (this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; (this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; (this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; (this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; } +>undefined : undefined + +let c10 = c.foo.call(c, 10, "hello"); +>c10 : string +>c.foo.call(c, 10, "hello") : string +>c.foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c : C +>10 : 10 +>"hello" : "hello" + +let c11 = c.foo.call(c, 10); // Error +>c11 : any +>c.foo.call(c, 10) : any +>c.foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c : C +>10 : 10 + +let c12 = c.foo.call(c, 10, 20); // Error +>c12 : any +>c.foo.call(c, 10, 20) : any +>c.foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c : C +>10 : 10 +>20 : 20 + +let c13 = c.foo.call(c, 10, "hello", 30); // Error +>c13 : any +>c.foo.call(c, 10, "hello", 30) : any +>c.foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c : C +>10 : 10 +>"hello" : "hello" +>30 : 30 + +let c14 = c.foo.call(undefined, 10, "hello"); // Error +>c14 : any +>c.foo.call(undefined, 10, "hello") : any +>c.foo.call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>call : (this: (this: T, ...args: A) => R, thisArg: T, ...args: A) => R +>undefined : undefined +>10 : 10 +>"hello" : "hello" + +let a10 = c.foo.apply(c, [10, "hello"]); +>a10 : string +>c.foo.apply(c, [10, "hello"]) : string +>c.foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c : C +>[10, "hello"] : [number, string] +>10 : 10 +>"hello" : "hello" + +let a11 = c.foo.apply(c, [10]); // Error +>a11 : any +>c.foo.apply(c, [10]) : any +>c.foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c : C +>[10] : number[] +>10 : 10 + +let a12 = c.foo.apply(c, [10, 20]); // Error +>a12 : any +>c.foo.apply(c, [10, 20]) : any +>c.foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c : C +>[10, 20] : number[] +>10 : 10 +>20 : 20 + +let a13 = c.foo.apply(c, [10, "hello", 30]); // Error +>a13 : any +>c.foo.apply(c, [10, "hello", 30]) : any +>c.foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c : C +>[10, "hello", 30] : (string | number)[] +>10 : 10 +>"hello" : "hello" +>30 : 30 + +let a14 = c.foo.apply(undefined, [10, "hello"]); // Error +>a14 : any +>c.foo.apply(undefined, [10, "hello"]) : any +>c.foo.apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>c.foo : (this: C, a: number, b: string) => string +>c : C +>foo : (this: C, a: number, b: string) => string +>apply : { (this: (this: T) => R, thisArg: T): R; (this: (this: T, ...args: A) => R, thisArg: T, args: A): R; } +>undefined : undefined +>[10, "hello"] : (string | number)[] +>10 : 10 +>"hello" : "hello" + +let f20 = C.bind(undefined); +>f20 : new (a: number, b: string) => C +>C.bind(undefined) : new (a: number, b: string) => C +>C.bind : {
(this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>C : typeof C +>bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>undefined : undefined + +let f21 = C.bind(undefined, 10); +>f21 : new (b: string) => C +>C.bind(undefined, 10) : new (b: string) => C +>C.bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>C : typeof C +>bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>undefined : undefined +>10 : 10 + +let f22 = C.bind(undefined, 10, "hello"); +>f22 : new () => C +>C.bind(undefined, 10, "hello") : new () => C +>C.bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>C : typeof C +>bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>undefined : undefined +>10 : 10 +>"hello" : "hello" + +let f23 = C.bind(undefined, 10, 20); // Error +>f23 : any +>C.bind(undefined, 10, 20) : any +>C.bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>C : typeof C +>bind : { (this: new (...args: A) => R, thisArg: any): new (...args: A) => R; (this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; (this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; (this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; } +>undefined : undefined +>10 : 10 +>20 : 20 + +C.call(c, 10, "hello"); +>C.call(c, 10, "hello") : void +>C.call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>C : typeof C +>call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>c : C +>10 : 10 +>"hello" : "hello" + +C.call(c, 10); // Error +>C.call(c, 10) : any +>C.call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>C : typeof C +>call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>c : C +>10 : 10 + +C.call(c, 10, 20); // Error +>C.call(c, 10, 20) : any +>C.call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>C : typeof C +>call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>c : C +>10 : 10 +>20 : 20 + +C.call(c, 10, "hello", 30); // Error +>C.call(c, 10, "hello", 30) : any +>C.call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>C : typeof C +>call : (this: new (...args: A) => T, thisArg: T, ...args: A) => void +>c : C +>10 : 10 +>"hello" : "hello" +>30 : 30 + +C.apply(c, [10, "hello"]); +>C.apply(c, [10, "hello"]) : void +>C.apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>C : typeof C +>apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>c : C +>[10, "hello"] : [number, string] +>10 : 10 +>"hello" : "hello" + +C.apply(c, [10]); // Error +>C.apply(c, [10]) : any +>C.apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>C : typeof C +>apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>c : C +>[10] : number[] +>10 : 10 + +C.apply(c, [10, 20]); // Error +>C.apply(c, [10, 20]) : any +>C.apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>C : typeof C +>apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>c : C +>[10, 20] : number[] +>10 : 10 +>20 : 20 + +C.apply(c, [10, "hello", 30]); // Error +>C.apply(c, [10, "hello", 30]) : any +>C.apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>C : typeof C +>apply : { (this: new () => T, thisArg: T): void; (this: new (...args: A) => T, thisArg: T, args: A): void; } +>c : C +>[10, "hello", 30] : (string | number)[] +>10 : 10 +>"hello" : "hello" +>30 : 30 + diff --git a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json index 261cdca7011..e4e3d7b8ec4 100644 --- a/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json @@ -25,6 +25,7 @@ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json index d3a9f8e9f47..1919671c489 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -25,6 +25,7 @@ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index 8484e61bcfa..3b49dee6e3d 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -25,6 +25,7 @@ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index 35aa1cf7eab..d91e167877d 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -25,6 +25,7 @@ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json index fbc441b823c..e6107b29b4c 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json @@ -25,6 +25,7 @@ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index f758c1f6c20..7c18b695c7b 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -25,6 +25,7 @@ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index 261cdca7011..e4e3d7b8ec4 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -25,6 +25,7 @@ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index cdb52963ccb..eedcc357043 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -25,6 +25,7 @@ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ diff --git a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json index fd6419e1e35..6fc7833730f 100644 --- a/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -25,6 +25,7 @@ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ diff --git a/tests/baselines/reference/undefinedAssignableToGenericMappedIntersection.js b/tests/baselines/reference/undefinedAssignableToGenericMappedIntersection.js new file mode 100644 index 00000000000..468344c3e9c --- /dev/null +++ b/tests/baselines/reference/undefinedAssignableToGenericMappedIntersection.js @@ -0,0 +1,16 @@ +//// [undefinedAssignableToGenericMappedIntersection.ts] +type Errors = { [P in keyof T]: string | undefined } & {all: string | undefined}; +function foo() { + let obj!: Errors + let x!: keyof T; + obj[x] = undefined; +} + + +//// [undefinedAssignableToGenericMappedIntersection.js] +"use strict"; +function foo() { + var obj; + var x; + obj[x] = undefined; +} diff --git a/tests/baselines/reference/undefinedAssignableToGenericMappedIntersection.symbols b/tests/baselines/reference/undefinedAssignableToGenericMappedIntersection.symbols new file mode 100644 index 00000000000..613b3bcc538 --- /dev/null +++ b/tests/baselines/reference/undefinedAssignableToGenericMappedIntersection.symbols @@ -0,0 +1,27 @@ +=== tests/cases/compiler/undefinedAssignableToGenericMappedIntersection.ts === +type Errors = { [P in keyof T]: string | undefined } & {all: string | undefined}; +>Errors : Symbol(Errors, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 0)) +>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 12)) +>P : Symbol(P, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 20)) +>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 12)) +>all : Symbol(all, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 59)) + +function foo() { +>foo : Symbol(foo, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 84)) +>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 1, 13)) + + let obj!: Errors +>obj : Symbol(obj, Decl(undefinedAssignableToGenericMappedIntersection.ts, 2, 7)) +>Errors : Symbol(Errors, Decl(undefinedAssignableToGenericMappedIntersection.ts, 0, 0)) +>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 1, 13)) + + let x!: keyof T; +>x : Symbol(x, Decl(undefinedAssignableToGenericMappedIntersection.ts, 3, 7)) +>T : Symbol(T, Decl(undefinedAssignableToGenericMappedIntersection.ts, 1, 13)) + + obj[x] = undefined; +>obj : Symbol(obj, Decl(undefinedAssignableToGenericMappedIntersection.ts, 2, 7)) +>x : Symbol(x, Decl(undefinedAssignableToGenericMappedIntersection.ts, 3, 7)) +>undefined : Symbol(undefined) +} + diff --git a/tests/baselines/reference/undefinedAssignableToGenericMappedIntersection.types b/tests/baselines/reference/undefinedAssignableToGenericMappedIntersection.types new file mode 100644 index 00000000000..1bf4aae0198 --- /dev/null +++ b/tests/baselines/reference/undefinedAssignableToGenericMappedIntersection.types @@ -0,0 +1,22 @@ +=== tests/cases/compiler/undefinedAssignableToGenericMappedIntersection.ts === +type Errors = { [P in keyof T]: string | undefined } & {all: string | undefined}; +>Errors : Errors +>all : string | undefined + +function foo() { +>foo : () => void + + let obj!: Errors +>obj : Errors + + let x!: keyof T; +>x : keyof T + + obj[x] = undefined; +>obj[x] = undefined : undefined +>obj[x] : Errors[keyof T] +>obj : Errors +>x : keyof T +>undefined : undefined +} + diff --git a/tests/baselines/reference/user/adonis-framework.log b/tests/baselines/reference/user/adonis-framework.log index 7796b296dbe..a370c326c0a 100644 --- a/tests/baselines/reference/user/adonis-framework.log +++ b/tests/baselines/reference/user/adonis-framework.log @@ -39,10 +39,15 @@ node_modules/adonis-framework/src/Event/index.js(128,12): error TS2322: Type '() Property 'pop' is missing in type '() => {}[]'. node_modules/adonis-framework/src/Event/index.js(153,25): error TS2339: Property 'wildcard' does not exist on type 'EventEmitter2'. node_modules/adonis-framework/src/Event/index.js(188,17): error TS2304: Cannot find name 'Spread'. +node_modules/adonis-framework/src/Event/index.js(201,27): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. + Property 'pop' is missing in type 'IArguments'. node_modules/adonis-framework/src/Event/index.js(207,24): error TS2304: Cannot find name 'Sring'. node_modules/adonis-framework/src/Event/index.js(256,52): error TS2345: Argument of type 'Function' is not assignable to parameter of type 'Listener'. Type 'Function' provides no match for the signature '(...values: any[]): void'. node_modules/adonis-framework/src/Event/index.js(264,28): error TS2345: Argument of type 'Function' is not assignable to parameter of type 'Listener'. +node_modules/adonis-framework/src/Event/index.js(271,25): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[string, any, TimerHandler]'. + Property '0' is missing in type 'IArguments'. +node_modules/adonis-framework/src/Event/index.js(278,25): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[string, any, TimerHandler]'. node_modules/adonis-framework/src/Event/index.js(294,30): error TS2345: Argument of type 'Function' is not assignable to parameter of type 'Listener'. node_modules/adonis-framework/src/Exceptions/index.js(13,14): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. node_modules/adonis-framework/src/Exceptions/index.js(27,12): error TS2554: Expected 0 arguments, but got 3. @@ -107,6 +112,13 @@ node_modules/adonis-framework/src/Response/index.js(95,16): error TS2304: Cannot node_modules/adonis-framework/src/Response/index.js(172,15): error TS2304: Cannot find name 'Mixed'. node_modules/adonis-framework/src/Response/index.js(299,15): error TS2304: Cannot find name 'Mixed'. node_modules/adonis-framework/src/Response/index.js(323,15): error TS2304: Cannot find name 'Mixed'. +node_modules/adonis-framework/src/Route/ResourceCollection.js(43,40): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. + Property 'pop' is missing in type 'IArguments'. +node_modules/adonis-framework/src/Route/ResourceCollection.js(56,31): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. +node_modules/adonis-framework/src/Route/ResourceMember.js(43,40): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. +node_modules/adonis-framework/src/Route/ResourceMember.js(56,31): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. +node_modules/adonis-framework/src/Route/group.js(34,31): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. +node_modules/adonis-framework/src/Route/group.js(43,41): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. node_modules/adonis-framework/src/Route/helpers.js(22,13): error TS2304: Cannot find name 'Any'. node_modules/adonis-framework/src/Route/helpers.js(34,3): error TS2322: Type 'string | string[]' is not assignable to type 'string'. Type 'string[]' is not assignable to type 'string'. @@ -120,6 +132,8 @@ node_modules/adonis-framework/src/Route/index.js(259,21): error TS2345: Argument node_modules/adonis-framework/src/Route/index.js(280,21): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'string'. node_modules/adonis-framework/src/Route/index.js(321,13): error TS2304: Cannot find name 'Mixed'. node_modules/adonis-framework/src/Route/index.js(321,20): error TS8029: JSDoc '@param' tag has name 'keys', but there is no parameter with that name. It would match 'arguments' if it had an array type. +node_modules/adonis-framework/src/Route/index.js(333,29): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. +node_modules/adonis-framework/src/Route/index.js(343,33): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. node_modules/adonis-framework/src/Route/index.js(354,20): error TS2694: Namespace 'Route' has no exported member 'Group'. node_modules/adonis-framework/src/Route/index.js(368,3): error TS2322: Type 'null' is not assignable to type 'string'. node_modules/adonis-framework/src/Route/index.js(396,10): error TS2554: Expected 2 arguments, but got 3. @@ -133,11 +147,16 @@ node_modules/adonis-framework/src/Route/resource.js(96,25): error TS2345: Argume node_modules/adonis-framework/src/Route/resource.js(97,25): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'string'. node_modules/adonis-framework/src/Route/resource.js(172,15): error TS2304: Cannot find name 'Mixed'. node_modules/adonis-framework/src/Route/resource.js(172,22): error TS8029: JSDoc '@param' tag has name 'methods', but there is no parameter with that name. It would match 'arguments' if it had an array type. +node_modules/adonis-framework/src/Route/resource.js(183,45): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. node_modules/adonis-framework/src/Route/resource.js(198,15): error TS2304: Cannot find name 'Mixed'. node_modules/adonis-framework/src/Route/resource.js(198,22): error TS8029: JSDoc '@param' tag has name 'methods', but there is no parameter with that name. It would match 'arguments' if it had an array type. +node_modules/adonis-framework/src/Route/resource.js(209,45): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. node_modules/adonis-framework/src/Route/resource.js(233,15): error TS2304: Cannot find name 'Mixed'. node_modules/adonis-framework/src/Route/resource.js(261,15): error TS2304: Cannot find name 'Mixed'. +node_modules/adonis-framework/src/Route/resource.js(290,40): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any, ...any[]]'. + Property '0' is missing in type 'IArguments'. node_modules/adonis-framework/src/Route/resource.js(296,15): error TS2304: Cannot find name 'Mixed'. +node_modules/adonis-framework/src/Route/resource.js(314,62): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. node_modules/adonis-framework/src/Server/helpers.js(17,29): error TS8024: JSDoc '@param' tag has name 'appNamespace', but there is no parameter with that name. node_modules/adonis-framework/src/Server/index.js(17,21): error TS2307: Cannot find module 'adonis-fold'. node_modules/adonis-framework/src/Server/index.js(54,21): error TS2554: Expected 4 arguments, but got 3. diff --git a/tests/baselines/reference/user/bluebird.log b/tests/baselines/reference/user/bluebird.log index 35d6d9ca05b..0c4d4ab75fd 100644 --- a/tests/baselines/reference/user/bluebird.log +++ b/tests/baselines/reference/user/bluebird.log @@ -20,6 +20,10 @@ node_modules/bluebird/js/release/debuggability.js(168,17): error TS2403: Subsequ node_modules/bluebird/js/release/debuggability.js(174,26): error TS2339: Property 'detail' does not exist on type 'Event'. node_modules/bluebird/js/release/debuggability.js(175,17): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any) | ((o: any, key: any, desc: any) => any)' has no compatible call signatures. node_modules/bluebird/js/release/debuggability.js(176,17): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType) => any) | ((o: any, key: any, desc: any) => any)' has no compatible call signatures. +node_modules/bluebird/js/release/debuggability.js(199,48): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '["removeListener", string, (...args: any[]) => void]'. + Property '0' is missing in type 'IArguments'. +node_modules/bluebird/js/release/debuggability.js(242,56): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. + Property 'pop' is missing in type 'IArguments'. node_modules/bluebird/js/release/debuggability.js(491,19): error TS2350: Only a void function can be called with the 'new' keyword. node_modules/bluebird/js/release/debuggability.js(562,46): error TS2554: Expected 0 arguments, but got 1. node_modules/bluebird/js/release/debuggability.js(736,5): error TS2721: Cannot invoke an object which is possibly 'null'. @@ -50,6 +54,7 @@ node_modules/bluebird/js/release/map.js(111,23): error TS2339: Property '_values node_modules/bluebird/js/release/map.js(113,18): error TS2339: Property '_isResolved' does not exist on type 'MappingPromiseArray'. node_modules/bluebird/js/release/map.js(127,10): error TS2339: Property '_resolve' does not exist on type 'MappingPromiseArray'. node_modules/bluebird/js/release/map.js(156,66): error TS2339: Property 'promise' does not exist on type 'MappingPromiseArray'. +node_modules/bluebird/js/release/method.js(15,46): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. node_modules/bluebird/js/release/nodeback.js(21,20): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: {}) => string[]) | ((o: any) => string[])' has no compatible call signatures. node_modules/bluebird/js/release/nodeify.js(32,19): error TS2339: Property 'cause' does not exist on type 'Error'. node_modules/bluebird/js/release/promise.js(4,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. diff --git a/tests/baselines/reference/user/chrome-devtools-frontend.log b/tests/baselines/reference/user/chrome-devtools-frontend.log index 2936205dc19..2fcfcea49f0 100644 --- a/tests/baselines/reference/user/chrome-devtools-frontend.log +++ b/tests/baselines/reference/user/chrome-devtools-frontend.log @@ -11,8 +11,8 @@ Standard output: ../../../../built/local/lib.dom.d.ts(11899,13): error TS2300: Duplicate identifier 'Request'. ../../../../built/local/lib.dom.d.ts(16316,11): error TS2300: Duplicate identifier 'Window'. ../../../../built/local/lib.dom.d.ts(16447,13): error TS2300: Duplicate identifier 'Window'. -../../../../built/local/lib.es5.d.ts(1346,11): error TS2300: Duplicate identifier 'ArrayLike'. -../../../../built/local/lib.es5.d.ts(1382,6): error TS2300: Duplicate identifier 'Record'. +../../../../built/local/lib.es5.d.ts(1406,11): error TS2300: Duplicate identifier 'ArrayLike'. +../../../../built/local/lib.es5.d.ts(1442,6): error TS2300: Duplicate identifier 'Record'. ../../../../node_modules/@types/node/index.d.ts(150,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'module' must be of type '{}', but here has type 'NodeModule'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(43,8): error TS2339: Property '_importScriptPathPrefix' does not exist on type 'Window'. node_modules/chrome-devtools-frontend/front_end/Runtime.js(95,28): error TS2339: Property 'response' does not exist on type 'EventTarget'. diff --git a/tests/baselines/reference/user/debug.log b/tests/baselines/reference/user/debug.log index dba95024e7c..da4e47f9207 100644 --- a/tests/baselines/reference/user/debug.log +++ b/tests/baselines/reference/user/debug.log @@ -41,6 +41,8 @@ node_modules/debug/dist/debug.js(733,74): error TS2339: Property 'process' does node_modules/debug/dist/debug.js(733,112): error TS2339: Property 'process' does not exist on type 'Window'. node_modules/debug/dist/debug.js(744,146): error TS2551: Property 'WebkitAppearance' does not exist on type 'CSSStyleDeclaration'. Did you mean 'webkitAppearance'? node_modules/debug/dist/debug.js(745,78): error TS2339: Property 'firebug' does not exist on type 'Console'. +node_modules/debug/dist/debug.js(799,156): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?, ...any[]]'. + Property 'pop' is missing in type 'IArguments'. node_modules/debug/dist/debug.js(851,21): error TS2304: Cannot find name 'LocalStorage'. node_modules/debug/src/browser.js(3,100): error TS2539: Cannot assign to '_typeof' because it is not a variable. node_modules/debug/src/browser.js(3,165): error TS2539: Cannot assign to '_typeof' because it is not a variable. @@ -49,6 +51,7 @@ node_modules/debug/src/browser.js(34,66): error TS2339: Property 'process' does node_modules/debug/src/browser.js(34,104): error TS2339: Property 'process' does not exist on type 'Window'. node_modules/debug/src/browser.js(45,138): error TS2551: Property 'WebkitAppearance' does not exist on type 'CSSStyleDeclaration'. Did you mean 'webkitAppearance'? node_modules/debug/src/browser.js(46,70): error TS2339: Property 'firebug' does not exist on type 'Console'. +node_modules/debug/src/browser.js(100,148): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?, ...any[]]'. node_modules/debug/src/browser.js(152,13): error TS2304: Cannot find name 'LocalStorage'. node_modules/debug/src/common.js(51,24): error TS2339: Property 'colors' does not exist on type '{ (namespace: string): Function; debug: any; default: any; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: any; ... 4 more ...; selectColor: (namespace: string) => string | number; }'. node_modules/debug/src/common.js(51,60): error TS2339: Property 'colors' does not exist on type '{ (namespace: string): Function; debug: any; default: any; coerce: (val: any) => any; disable: () => void; enable: (namespaces: string) => void; enabled: (name: string) => boolean; humanize: any; ... 4 more ...; selectColor: (namespace: string) => string | number; }'. @@ -79,6 +82,8 @@ node_modules/debug/src/node.js(56,5): error TS2322: Type 'false' is not assignab node_modules/debug/src/node.js(58,5): error TS2322: Type 'null' is not assignable to type 'string | undefined'. node_modules/debug/src/node.js(60,5): error TS2322: Type 'number' is not assignable to type 'string | undefined'. node_modules/debug/src/node.js(71,108): error TS2339: Property 'fd' does not exist on type 'WriteStream'. +node_modules/debug/src/node.js(108,55): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any, ...any[]]'. + Property '0' is missing in type 'IArguments'. node_modules/debug/src/node.js(136,3): error TS2322: Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. diff --git a/tests/baselines/reference/user/graceful-fs.log b/tests/baselines/reference/user/graceful-fs.log index a0721706f16..ef5a4e24f37 100644 --- a/tests/baselines/reference/user/graceful-fs.log +++ b/tests/baselines/reference/user/graceful-fs.log @@ -5,11 +5,18 @@ node_modules/graceful-fs/fs.js(17,38): error TS2345: Argument of type 'PropertyD Type 'undefined' is not assignable to type 'PropertyDescriptor & ThisType'. Type 'undefined' is not assignable to type 'PropertyDescriptor'. node_modules/graceful-fs/graceful-fs.js(12,3): error TS2322: Type '(msg: string, ...param: any[]) => void' is not assignable to type '() => void'. +node_modules/graceful-fs/graceful-fs.js(15,37): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any, ...any[]]'. + Property '0' is missing in type 'IArguments'. node_modules/graceful-fs/graceful-fs.js(22,5): error TS2554: Expected 0 arguments, but got 1. -node_modules/graceful-fs/graceful-fs.js(37,1): error TS2322: Type '(fd: any, cb: any) => any' is not assignable to type 'typeof close'. - Property '__promisify__' is missing in type '(fd: any, cb: any) => any'. +node_modules/graceful-fs/graceful-fs.js(37,1): error TS2322: Type '(fd: any, cb: any) => void' is not assignable to type 'typeof close'. + Property '__promisify__' is missing in type '(fd: any, cb: any) => void'. +node_modules/graceful-fs/graceful-fs.js(51,37): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[number]'. + Property '0' is missing in type 'IArguments'. node_modules/graceful-fs/graceful-fs.js(161,5): error TS2539: Cannot assign to 'ReadStream' because it is not a variable. node_modules/graceful-fs/graceful-fs.js(162,5): error TS2539: Cannot assign to 'WriteStream' because it is not a variable. +node_modules/graceful-fs/graceful-fs.js(180,68): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?, any?, ...any[]]'. + Property 'pop' is missing in type 'IArguments'. +node_modules/graceful-fs/graceful-fs.js(203,70): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?, any?, ...any[]]'. node_modules/graceful-fs/graceful-fs.js(252,3): error TS2554: Expected 0 arguments, but got 3. node_modules/graceful-fs/graceful-fs.js(259,5): error TS2554: Expected 0 arguments, but got 3. diff --git a/tests/baselines/reference/user/lodash.log b/tests/baselines/reference/user/lodash.log index 383dcf9fe6f..ff3d4e7cabf 100644 --- a/tests/baselines/reference/user/lodash.log +++ b/tests/baselines/reference/user/lodash.log @@ -41,6 +41,9 @@ node_modules/lodash/_baseFlatten.js(19,29): error TS2322: Type '(value: any) => node_modules/lodash/_baseFlatten.js(24,22): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Boolean' has no compatible call signatures. node_modules/lodash/_baseFlatten.js(24,22): error TS2532: Object is possibly 'undefined'. node_modules/lodash/_baseFlatten.js(24,22): error TS2722: Cannot invoke an object which is possibly 'undefined'. +node_modules/lodash/_baseHas.js(16,56): error TS2345: Argument of type 'string | any[]' is not assignable to parameter of type 'string | number | symbol'. + Type 'any[]' is not assignable to type 'string | number | symbol'. + Type 'any[]' is not assignable to type 'symbol'. node_modules/lodash/_baseIntersection.js(53,40): error TS2345: Argument of type 'Function | undefined' is not assignable to parameter of type 'Function'. Type 'undefined' is not assignable to type 'Function'. node_modules/lodash/_baseIntersection.js(60,54): error TS2345: Argument of type 'Function | undefined' is not assignable to parameter of type 'Function'. @@ -126,6 +129,8 @@ node_modules/lodash/_createWrap.js(96,26): error TS2345: Argument of type 'Timer node_modules/lodash/_createWrap.js(97,100): error TS2532: Object is possibly 'undefined'. node_modules/lodash/_createWrap.js(98,28): error TS2345: Argument of type 'TimerHandler' is not assignable to parameter of type 'Function'. Type 'string' is not assignable to type 'Function'. +node_modules/lodash/_createWrap.js(100,44): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[TimerHandler, number, any?, (any[] | undefined)?, (any[] | undefined)?, (any[] | undefined)?, (any[] | undefined)?, (any[] | undefined)?, (number | undefined)?, (number | undefined)?]'. + Property '0' is missing in type 'any[]'. node_modules/lodash/_createWrap.js(103,51): error TS2345: Argument of type 'TimerHandler' is not assignable to parameter of type 'Function'. Type 'string' is not assignable to type 'Function'. node_modules/lodash/_customDefaultsMerge.js(22,35): error TS2345: Argument of type 'undefined' is not assignable to parameter of type 'number'. @@ -227,6 +232,9 @@ node_modules/lodash/core.js(2183,41): error TS8024: JSDoc '@param' tag has name node_modules/lodash/core.js(2473,21): error TS2554: Expected 0 arguments, but got 1. node_modules/lodash/core.js(2609,39): error TS2554: Expected 0 arguments, but got 1. node_modules/lodash/core.js(2644,12): error TS2554: Expected 3-5 arguments, but got 2. +node_modules/lodash/core.js(3245,58): error TS2345: Argument of type 'string | any[]' is not assignable to parameter of type 'string | number | symbol'. + Type 'any[]' is not assignable to type 'string | number | symbol'. + Type 'any[]' is not assignable to type 'symbol'. node_modules/lodash/core.js(3354,53): error TS2538: Type 'any[]' cannot be used as an index type. node_modules/lodash/core.js(3424,41): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(substring: string, ...args: any[]) => string'. Type 'Function' provides no match for the signature '(substring: string, ...args: any[]): string'. diff --git a/tests/baselines/reference/user/npm.log b/tests/baselines/reference/user/npm.log index 231b400a980..3bdb3b1b9ec 100644 --- a/tests/baselines/reference/user/npm.log +++ b/tests/baselines/reference/user/npm.log @@ -29,6 +29,8 @@ node_modules/npm/bin/npm-cli.js(128,13): error TS2339: Property 'command' does n node_modules/npm/bin/npm-cli.js(132,17): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. node_modules/npm/bin/npm-cli.js(134,17): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. node_modules/npm/bin/npm-cli.js(136,17): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. +node_modules/npm/bin/npm-cli.js(140,32): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?]'. + Property 'pop' is missing in type 'IArguments'. node_modules/npm/html/static/toc.js(3,40): error TS2531: Object is possibly 'null'. node_modules/npm/lib/access.js(58,46): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/access.js(65,18): error TS2339: Property 'registry' does not exist on type 'typeof EventEmitter'. @@ -58,7 +60,10 @@ node_modules/npm/lib/auth/legacy.js(12,30): error TS2339: Property 'config' does node_modules/npm/lib/auth/legacy.js(35,16): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/auth/legacy.js(69,33): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/auth/oauth.js(5,7): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. +node_modules/npm/lib/auth/oauth.js(6,29): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?, any?, any?, any?]'. + Property 'pop' is missing in type 'IArguments'. node_modules/npm/lib/auth/saml.js(5,7): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. +node_modules/npm/lib/auth/saml.js(6,29): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?, any?, any?, any?]'. node_modules/npm/lib/auth/sso.js(7,21): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/auth/sso.js(20,7): error TS2339: Property 'registry' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/auth/sso.js(28,36): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. @@ -147,6 +152,8 @@ node_modules/npm/lib/config/core.js(333,10): error TS2339: Property 'emit' does node_modules/npm/lib/config/core.js(409,29): error TS2345: Argument of type '(orig: string, esc: any, name: any) => string | undefined' is not assignable to parameter of type '(substring: string, ...args: any[]) => string'. Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'. +node_modules/npm/lib/config/defaults.js(20,52): error TS2345: Argument of type 'never[]' is not assignable to parameter of type '[any, ...any[]]'. + Property '0' is missing in type 'never[]'. node_modules/npm/lib/config/gentle-fs.js(16,11): error TS2339: Property 'prefix' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/config/gentle-fs.js(17,11): error TS2339: Property 'globalPrefix' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/config/gentle-fs.js(18,11): error TS2339: Property 'dir' does not exist on type 'typeof EventEmitter'. @@ -430,8 +437,8 @@ node_modules/npm/lib/install.js(268,26): error TS2339: Property 'config' does no node_modules/npm/lib/install.js(269,9): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/install.js(272,11): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/install.js(273,7): error TS2532: Object is possibly 'undefined'. -node_modules/npm/lib/install.js(273,7): error TS2684: The 'this' context of type '((err: any, ...args: any[]) => any) | undefined' is not assignable to method's 'this' of type 'Function'. - Type 'undefined' is not assignable to type 'Function'. +node_modules/npm/lib/install.js(273,7): error TS2684: The 'this' context of type '((err: any, ...args: any[]) => any) | undefined' is not assignable to method's 'this' of type '(this: null, err?: any, ...args: any[]) => any'. + Type 'undefined' is not assignable to type '(this: null, err?: any, ...args: any[]) => any'. node_modules/npm/lib/install.js(340,25): error TS2339: Property 'failing' does not exist on type 'Installer'. node_modules/npm/lib/install.js(369,18): error TS2345: Argument of type '"time"' is not assignable to parameter of type 'Signals'. node_modules/npm/lib/install.js(376,16): error TS2345: Argument of type '"timeEnd"' is not assignable to parameter of type 'Signals'. @@ -837,6 +844,8 @@ node_modules/npm/lib/utils/metrics.js(61,31): error TS2345: Argument of type 'Bu node_modules/npm/lib/utils/metrics.js(62,7): error TS2339: Property 'load' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/utils/metrics.js(64,9): error TS2339: Property 'registry' does not exist on type 'typeof EventEmitter'. node_modules/npm/lib/utils/metrics.js(65,9): error TS2339: Property 'registry' does not exist on type 'typeof EventEmitter'. +node_modules/npm/lib/utils/output.js(6,30): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?, ...any[]]'. + Property 'pop' is missing in type 'IArguments'. node_modules/npm/lib/utils/perf.js(9,12): error TS2345: Argument of type '"time"' is not assignable to parameter of type 'Signals'. node_modules/npm/lib/utils/perf.js(10,12): error TS2345: Argument of type '"timeEnd"' is not assignable to parameter of type 'Signals'. node_modules/npm/lib/utils/read-local-package.js(7,11): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. @@ -909,6 +918,8 @@ node_modules/npm/test/broken-under-nyc-and-travis/whoami.js(7,20): error TS2307: node_modules/npm/test/common-tap.js(5,47): error TS2339: Property '_extend' does not exist on type 'typeof import("util")'. node_modules/npm/test/common-tap.js(10,3): error TS2322: Type '(...args: any[]) => void' is not assignable to type 'typeof setImmediate'. Property '__promisify__' is missing in type '(...args: any[]) => void'. +node_modules/npm/test/common-tap.js(12,28): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[(...args: any[]) => void, number, ...any[]]'. + Property '0' is missing in type 'any[]'. node_modules/npm/test/common-tap.js(175,17): error TS2339: Property '_storage' does not exist on type 'Environment'. node_modules/npm/test/common-tap.js(181,31): error TS2339: Property '_storage' does not exist on type 'Environment'. node_modules/npm/test/common-tap.js(192,12): error TS2339: Property '_storage' does not exist on type 'Environment'. @@ -927,6 +938,8 @@ node_modules/npm/test/need-npm5-update/legacy-dir-bin.js(2,20): error TS2307: Ca node_modules/npm/test/need-npm5-update/legacy-dir-bin.js(11,21): error TS2307: Cannot find module 'tacks'. node_modules/npm/test/need-npm5-update/legacy-npm-self-install.js(2,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/need-npm5-update/legacy-npm-self-install.js(12,47): error TS2339: Property '_extend' does not exist on type 'typeof import("util")'. +node_modules/npm/test/need-npm5-update/legacy-npm-self-install.js(34,42): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'string[]'. + Property 'pop' is missing in type 'IArguments'. node_modules/npm/test/need-npm5-update/legacy-npm-self-install.js(48,3): error TS2322: Type 'null' is not assignable to type 'string | undefined'. node_modules/npm/test/need-npm5-update/legacy-npm-self-install.js(49,3): error TS2322: Type 'null' is not assignable to type 'string | undefined'. node_modules/npm/test/need-npm5-update/legacy-optional-deps.js(4,20): error TS2307: Cannot find module 'tap'. @@ -936,6 +949,7 @@ node_modules/npm/test/need-npm5-update/legacy-shrinkwrap.js(2,20): error TS2307: node_modules/npm/test/need-npm5-update/legacy-shrinkwrap.js(6,21): error TS2307: Cannot find module 'tacks'. node_modules/npm/test/need-npm5-update/lifecycle-signal.js(8,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/need-npm5-update/move-no-clobber-dest-node-modules.js(3,20): error TS2307: Cannot find module 'tap'. +node_modules/npm/test/need-npm5-update/move-no-clobber-dest-node-modules.js(11,48): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'string[]'. node_modules/npm/test/need-npm5-update/need-only-update-save-optional/update-save.js(5,18): error TS2307: Cannot find module 'npm-registry-mock'. node_modules/npm/test/need-npm5-update/need-only-update-save-optional/update-save.js(8,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/need-npm5-update/need-only-update-save-optional/update-save.js(10,22): error TS2307: Cannot find module '../common-tap.js'. @@ -1436,6 +1450,8 @@ node_modules/npm/test/tap/outdated-json.js(5,18): error TS2307: Cannot find modu node_modules/npm/test/tap/outdated-json.js(8,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/tap/outdated-long.js(5,18): error TS2307: Cannot find module 'npm-registry-mock'. node_modules/npm/test/tap/outdated-long.js(7,20): error TS2307: Cannot find module 'tap'. +node_modules/npm/test/tap/outdated-long.js(63,31): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. + Property 'pop' is missing in type 'IArguments'. node_modules/npm/test/tap/outdated-long.js(66,9): error TS2339: Property 'load' does not exist on type 'typeof EventEmitter'. node_modules/npm/test/tap/outdated-long.js(74,13): error TS2339: Property 'install' does not exist on type 'typeof EventEmitter'. node_modules/npm/test/tap/outdated-long.js(76,15): error TS2339: Property 'config' does not exist on type 'typeof EventEmitter'. @@ -1444,6 +1460,7 @@ node_modules/npm/test/tap/outdated.js(5,18): error TS2307: Cannot find module 'n node_modules/npm/test/tap/outdated.js(7,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/tap/outdated.js(92,9): error TS2339: Property 'load' does not exist on type 'typeof EventEmitter'. node_modules/npm/test/tap/outdated.js(100,13): error TS2339: Property 'install' does not exist on type 'typeof EventEmitter'. +node_modules/npm/test/tap/outdated.js(103,39): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'. node_modules/npm/test/tap/outdated.js(105,15): error TS2339: Property 'outdated' does not exist on type 'typeof EventEmitter'. node_modules/npm/test/tap/override-bundled.js(3,20): error TS2307: Cannot find module 'tap'. node_modules/npm/test/tap/owner.js(1,18): error TS2307: Cannot find module 'npm-registry-mock'. diff --git a/tests/baselines/reference/user/npmlog.log b/tests/baselines/reference/user/npmlog.log index cdd163fa0f1..c9662cd1551 100644 --- a/tests/baselines/reference/user/npmlog.log +++ b/tests/baselines/reference/user/npmlog.log @@ -4,6 +4,8 @@ node_modules/npmlog/log.js(83,12): error TS2551: Property '_pause' does not exis node_modules/npmlog/log.js(149,8): error TS2551: Property '_paused' does not exist on type 'typeof EventEmitter'. Did you mean 'pause'? node_modules/npmlog/log.js(154,13): error TS2551: Property '_paused' does not exist on type 'typeof EventEmitter'. Did you mean 'pause'? node_modules/npmlog/log.js(155,8): error TS2551: Property '_paused' does not exist on type 'typeof EventEmitter'. Did you mean 'pause'? +node_modules/npmlog/log.js(194,37): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[any, ...any[]]'. + Property '0' is missing in type 'any[]'. node_modules/npmlog/log.js(218,12): error TS2551: Property '_paused' does not exist on type 'typeof EventEmitter'. Did you mean 'pause'? node_modules/npmlog/log.js(271,16): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'. diff --git a/tests/baselines/reference/user/prettier.log b/tests/baselines/reference/user/prettier.log index 0fd19e0d9a7..ae8f5cee3f1 100644 --- a/tests/baselines/reference/user/prettier.log +++ b/tests/baselines/reference/user/prettier.log @@ -6,6 +6,9 @@ src/cli/util.js(262,64): error TS2339: Property 'length' does not exist on type src/cli/util.js(335,52): error TS2339: Property 'length' does not exist on type 'Ignore'. src/cli/util.js(396,46): error TS2345: Argument of type 'null' is not assignable to parameter of type 'number | undefined'. src/cli/util.js(403,39): error TS2339: Property 'grey' does not exist on type 'typeof import("../../../node_modules/chalk/types/index")'. +src/cli/util.js(454,16): error TS2339: Property 'type' does not exist on type 'never'. +src/cli/util.js(455,16): error TS2339: Property 'oppositeDescription' does not exist on type 'never'. +src/cli/util.js(456,17): error TS2339: Property 'name' does not exist on type 'never'. src/common/parser-create-error.js(8,9): error TS2339: Property 'loc' does not exist on type 'SyntaxError'. src/config/resolve-config.js(75,32): error TS2345: Argument of type '{ sync: false; }' is not assignable to parameter of type '{ cache: boolean; sync: boolean; }'. Property 'cache' is missing in type '{ sync: false; }'. @@ -14,6 +17,8 @@ src/config/resolve-config.js(82,32): error TS2345: Argument of type '{ sync: tru src/doc/doc-printer.js(213,17): error TS2532: Object is possibly 'undefined'. src/doc/doc-printer.js(214,18): error TS2532: Object is possibly 'undefined'. src/doc/doc-printer.js(215,17): error TS2532: Object is possibly 'undefined'. +src/doc/doc-printer.js(447,37): error TS2345: Argument of type 'any[][]' is not assignable to parameter of type 'never[]'. + Type 'any[]' is not assignable to type 'never'. src/language-css/clean.js(3,30): error TS2307: Cannot find module 'html-tag-names'. src/language-css/parser-postcss.js(78,32): error TS2345: Argument of type '{ groups: never[]; type: string; }' is not assignable to parameter of type 'never'. src/language-css/parser-postcss.js(88,30): error TS2345: Argument of type '{ open: null; close: null; groups: never[]; type: string; }' is not assignable to parameter of type 'never'. diff --git a/tests/baselines/reference/user/uglify-js.log b/tests/baselines/reference/user/uglify-js.log index edb65213e6e..5bd01b81213 100644 --- a/tests/baselines/reference/user/uglify-js.log +++ b/tests/baselines/reference/user/uglify-js.log @@ -22,7 +22,11 @@ node_modules/uglify-js/lib/compress.js(1316,38): error TS2554: Expected 0 argume node_modules/uglify-js/lib/compress.js(1411,38): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'. node_modules/uglify-js/lib/compress.js(1519,27): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/compress.js(1551,26): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(1652,49): error TS2345: Argument of type 'number[]' is not assignable to parameter of type '[number, number, ...never[]]'. + Property '0' is missing in type 'number[]'. node_modules/uglify-js/lib/compress.js(1975,44): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(2013,53): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[number, number, ...never[]]'. + Property '0' is missing in type 'any[]'. node_modules/uglify-js/lib/compress.js(2161,19): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/compress.js(3214,23): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/compress.js(3227,33): error TS2322: Type '"f"' is not assignable to type 'boolean'. @@ -39,6 +43,8 @@ node_modules/uglify-js/lib/compress.js(3988,30): error TS2554: Expected 0 argume node_modules/uglify-js/lib/compress.js(4097,18): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/compress.js(4396,17): error TS2403: Subsequent variable declarations must have the same type. Variable 'body' must be of type 'any[]', but here has type 'any'. node_modules/uglify-js/lib/compress.js(4480,22): error TS2554: Expected 0 arguments, but got 1. +node_modules/uglify-js/lib/compress.js(4672,57): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[RegExp, (string | undefined)?]'. + Property '0' is missing in type 'any[]'. node_modules/uglify-js/lib/compress.js(4830,30): error TS2554: Expected 0 arguments, but got 1. node_modules/uglify-js/lib/compress.js(4837,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'code' must be of type 'string', but here has type '{ get: () => string; toString: () => string; indent: () => void; indentation: () => number; current_width: () => number; should_break: () => boolean; has_parens: () => boolean; newline: () => void; print: (str: any) => void; ... 24 more ...; parent: (n: any) => any; }'. node_modules/uglify-js/lib/compress.js(4841,36): error TS2532: Object is possibly 'undefined'. @@ -104,6 +110,9 @@ node_modules/uglify-js/lib/sourcemap.js(55,25): error TS2304: Cannot find name ' node_modules/uglify-js/lib/sourcemap.js(61,23): error TS2304: Cannot find name 'MOZ_SourceMap'. node_modules/uglify-js/tools/exit.js(7,32): error TS2339: Property 'bufferSize' does not exist on type 'WriteStream'. node_modules/uglify-js/tools/exit.js(7,61): error TS2339: Property 'bufferSize' does not exist on type 'WriteStream'. +node_modules/uglify-js/tools/exit.js(10,37): error TS2345: Argument of type 'any[]' is not assignable to parameter of type '[(number | undefined)?]'. + Types of property 'length' are incompatible. + Type 'number' is not assignable to type '0 | 1'. node_modules/uglify-js/tools/node.js(64,26): error TS2339: Property 'minify' does not exist on type 'typeof import("/uglify-js/node_modules/uglify-js/tools/node")'. diff --git a/tests/baselines/reference/user/util.log b/tests/baselines/reference/user/util.log index 743d8d5e332..6440d2f326b 100644 --- a/tests/baselines/reference/user/util.log +++ b/tests/baselines/reference/user/util.log @@ -8,6 +8,9 @@ node_modules/util/util.js(55,20): error TS2555: Expected at least 2 arguments, b node_modules/util/util.js(73,15): error TS2339: Property 'noDeprecation' does not exist on type 'Process'. node_modules/util/util.js(80,19): error TS2339: Property 'throwDeprecation' does not exist on type 'Process'. node_modules/util/util.js(82,26): error TS2339: Property 'traceDeprecation' does not exist on type 'Process'. +node_modules/util/util.js(106,49): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?, ...any[]]'. +node_modules/util/util.js(553,69): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[any?, ...any[]]'. + Property 'pop' is missing in type 'IArguments'. diff --git a/tests/cases/compiler/undefinedAssignableToGenericMappedIntersection.ts b/tests/cases/compiler/undefinedAssignableToGenericMappedIntersection.ts new file mode 100644 index 00000000000..2b089164676 --- /dev/null +++ b/tests/cases/compiler/undefinedAssignableToGenericMappedIntersection.ts @@ -0,0 +1,7 @@ +// @strict: true +type Errors = { [P in keyof T]: string | undefined } & {all: string | undefined}; +function foo() { + let obj!: Errors + let x!: keyof T; + obj[x] = undefined; +} diff --git a/tests/cases/conformance/functions/strictBindCallApply1.ts b/tests/cases/conformance/functions/strictBindCallApply1.ts new file mode 100644 index 00000000000..5a94d4b5416 --- /dev/null +++ b/tests/cases/conformance/functions/strictBindCallApply1.ts @@ -0,0 +1,59 @@ +// @strict: true + +declare function foo(a: number, b: string): string; + +let f00 = foo.bind(undefined); +let f01 = foo.bind(undefined, 10); +let f02 = foo.bind(undefined, 10, "hello"); +let f03 = foo.bind(undefined, 10, 20); // Error + +let c00 = foo.call(undefined, 10, "hello"); +let c01 = foo.call(undefined, 10); // Error +let c02 = foo.call(undefined, 10, 20); // Error +let c03 = foo.call(undefined, 10, "hello", 30); // Error + +let a00 = foo.apply(undefined, [10, "hello"]); +let a01 = foo.apply(undefined, [10]); // Error +let a02 = foo.apply(undefined, [10, 20]); // Error +let a03 = foo.apply(undefined, [10, "hello", 30]); // Error + +class C { + constructor(a: number, b: string) {} + foo(this: this, a: number, b: string): string { return "" } +} + +declare let c: C; +declare let obj: {}; + +let f10 = c.foo.bind(c); +let f11 = c.foo.bind(c, 10); +let f12 = c.foo.bind(c, 10, "hello"); +let f13 = c.foo.bind(c, 10, 20); // Error +let f14 = c.foo.bind(undefined); // Error + +let c10 = c.foo.call(c, 10, "hello"); +let c11 = c.foo.call(c, 10); // Error +let c12 = c.foo.call(c, 10, 20); // Error +let c13 = c.foo.call(c, 10, "hello", 30); // Error +let c14 = c.foo.call(undefined, 10, "hello"); // Error + +let a10 = c.foo.apply(c, [10, "hello"]); +let a11 = c.foo.apply(c, [10]); // Error +let a12 = c.foo.apply(c, [10, 20]); // Error +let a13 = c.foo.apply(c, [10, "hello", 30]); // Error +let a14 = c.foo.apply(undefined, [10, "hello"]); // Error + +let f20 = C.bind(undefined); +let f21 = C.bind(undefined, 10); +let f22 = C.bind(undefined, 10, "hello"); +let f23 = C.bind(undefined, 10, 20); // Error + +C.call(c, 10, "hello"); +C.call(c, 10); // Error +C.call(c, 10, 20); // Error +C.call(c, 10, "hello", 30); // Error + +C.apply(c, [10, "hello"]); +C.apply(c, [10]); // Error +C.apply(c, [10, 20]); // Error +C.apply(c, [10, "hello", 30]); // Error diff --git a/tests/cases/conformance/jsdoc/enumTagUseBeforeDefCrash.ts b/tests/cases/conformance/jsdoc/enumTagUseBeforeDefCrash.ts new file mode 100644 index 00000000000..f8f92b7bcc1 --- /dev/null +++ b/tests/cases/conformance/jsdoc/enumTagUseBeforeDefCrash.ts @@ -0,0 +1,13 @@ +// @noEmit: true +// @allowJs: true +// @checkJs: true +// @Filename: bug27134.js +/** + * @enum {number} + */ +var foo = { }; + +/** + * @type {foo} + */ +var s; diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport13.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport13.ts index d1e67ae9a90..59b2d7a9539 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport13.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport13.ts @@ -8,7 +8,7 @@ //// "version": "1.0.0", //// "types": "index", //// "typesVersions": { -//// "3.0": { "*" : ["ts3.0/*"] } +//// ">=3.1.0-0": { "*" : ["ts3.1/*"] } //// } //// } @@ -18,10 +18,10 @@ // @Filename: node_modules/ext/aaa.d.ts //// export {}; -// @Filename: node_modules/ext/ts3.0/index.d.ts +// @Filename: node_modules/ext/ts3.1/index.d.ts //// export {}; -// @Filename: node_modules/ext/ts3.0/zzz.d.ts +// @Filename: node_modules/ext/ts3.1/zzz.d.ts //// export {}; // @Filename: main.ts @@ -31,6 +31,6 @@ verify.completions({ marker: test.markerNames(), - exact: ["aaa", "index", "ts3.0", "zzz"], + exact: ["aaa", "index", "ts3.1", "zzz"], isNewIdentifierLocation: true, });