Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint

This commit is contained in:
Alexander T 2019-07-22 13:50:43 +03:00
commit 40f2f77358
16 changed files with 132 additions and 130 deletions

View File

@ -797,7 +797,7 @@ namespace FourSlash {
for (const include of toArray(options.includes)) {
const name = typeof include === "string" ? include : include.name;
const found = nameToEntries.get(name);
if (!found) throw this.raiseError(`No completion ${name} found`);
if (!found) throw this.raiseError(`Includes: completion '${name}' not found.`);
assert(found.length === 1); // Must use 'exact' for multiple completions with same name
this.verifyCompletionEntry(ts.first(found), include);
}
@ -806,7 +806,7 @@ namespace FourSlash {
for (const exclude of toArray(options.excludes)) {
assert(typeof exclude === "string");
if (nameToEntries.has(exclude)) {
this.raiseError(`Did not expect to get a completion named ${exclude}`);
this.raiseError(`Excludes: unexpected completion '${exclude}' found.`);
}
}
}
@ -4827,40 +4827,23 @@ namespace FourSlashInterface {
"interface",
"let",
"package",
"private",
"protected",
"public",
"static",
"yield",
"abstract",
"as",
"any",
"async",
"await",
"boolean",
"constructor",
"declare",
"get",
"infer",
"is",
"keyof",
"module",
"namespace",
"never",
"readonly",
"require",
"number",
"object",
"set",
"string",
"symbol",
"type",
"unique",
"unknown",
"from",
"global",
"bigint",
"of",
].map(keywordEntry);
export const statementKeywords: ReadonlyArray<ExpectedCompletionEntryObject> = statementKeywordsWithTypes.filter(k => {
@ -5041,40 +5024,23 @@ namespace FourSlashInterface {
"interface",
"let",
"package",
"private",
"protected",
"public",
"static",
"yield",
"abstract",
"as",
"any",
"async",
"await",
"boolean",
"constructor",
"declare",
"get",
"infer",
"is",
"keyof",
"module",
"namespace",
"never",
"readonly",
"require",
"number",
"object",
"set",
"string",
"symbol",
"type",
"unique",
"unknown",
"from",
"global",
"bigint",
"of",
].map(keywordEntry);
export const globalInJsKeywords = getInJsKeywords(globalKeywords);
@ -5127,11 +5093,6 @@ namespace FourSlashInterface {
export const insideMethodInJsKeywords = getInJsKeywords(insideMethodKeywords);
export const globalKeywordsPlusUndefined: ReadonlyArray<ExpectedCompletionEntryObject> = (() => {
const i = ts.findIndex(globalKeywords, x => x.name === "unique");
return [...globalKeywords.slice(0, i), keywordEntry("undefined"), ...globalKeywords.slice(i)];
})();
export const globals: ReadonlyArray<ExpectedCompletionEntryObject> = [
globalThisEntry,
...globalsVars,

View File

@ -1086,7 +1086,24 @@ namespace ts.server {
project.close();
if (Debug.shouldAssert(AssertionLevel.Normal)) {
this.filenameToScriptInfo.forEach(info => Debug.assert(!info.isAttached(project), "Found script Info still attached to project", () => `${project.projectName}: ScriptInfos still attached: ${JSON.stringify(mapDefined(arrayFrom(this.filenameToScriptInfo.values()), info => info.isAttached(project) ? info : undefined))}`));
this.filenameToScriptInfo.forEach(info => Debug.assert(
!info.isAttached(project),
"Found script Info still attached to project",
() => `${project.projectName}: ScriptInfos still attached: ${JSON.stringify(
arrayFrom(
mapDefinedIterator(
this.filenameToScriptInfo.values(),
info => info.isAttached(project) ?
{
fileName: info.fileName,
projects: info.containingProjects.map(p => p.projectName),
hasMixedContent: info.hasMixedContent
} : undefined
)
),
/*replacer*/ undefined,
" "
)}`));
}
// Remove the project from pending project updates
this.pendingProjectUpdates.delete(project.getProjectName());

View File

@ -947,11 +947,13 @@ namespace ts.Completions {
// Right of dot member completion list
completionKind = CompletionKind.PropertyAccess;
// Since this is qualified name check its a type node location
// Since this is qualified name check it's a type node location
const isImportType = isLiteralImportTypeNode(node);
const isTypeLocation = insideJsDocTagTypeExpression || (isImportType && !(node as ImportTypeNode).isTypeOf) || isPartOfTypeNode(node.parent);
const isTypeLocation = insideJsDocTagTypeExpression
|| (isImportType && !(node as ImportTypeNode).isTypeOf)
|| isPartOfTypeNode(node.parent)
|| isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker);
const isRhsOfImportDeclaration = isInRightSideOfInternalImportEqualsDeclaration(node);
const allowTypeOrValue = isRhsOfImportDeclaration || (!isTypeLocation && isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker));
if (isEntityName(node) || isImportType) {
const isNamespaceName = isModuleDeclaration(node.parent);
if (isNamespaceName) isNewIdentifierLocation = true;
@ -968,7 +970,7 @@ namespace ts.Completions {
isNamespaceName
// At `namespace N.M/**/`, if this is the only declaration of `M`, don't include `M` as a completion.
? symbol => !!(symbol.flags & SymbolFlags.Namespace) && !symbol.declarations.every(d => d.parent === node.parent)
: allowTypeOrValue ?
: isRhsOfImportDeclaration ?
// Any kind is allowed when dotting off namespace in internal import equals declaration
symbol => isValidTypeAccess(symbol) || isValidValueAccess(symbol) :
isTypeLocation ? isValidTypeAccess : isValidValueAccess;
@ -1181,7 +1183,6 @@ namespace ts.Completions {
function filterGlobalCompletion(symbols: Symbol[]): void {
const isTypeOnly = isTypeOnlyCompletion();
const allowTypes = isTypeOnly || !isContextTokenValueLocation(contextToken) && isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker);
if (isTypeOnly) {
keywordFilters = isTypeAssertion()
? KeywordCompletionFilters.TypeAssertionKeywords
@ -1202,12 +1203,9 @@ namespace ts.Completions {
return !!(symbol.flags & SymbolFlags.Namespace);
}
if (allowTypes) {
// Its a type, but you can reach it by namespace.type as well
const symbolAllowedAsType = symbolCanBeReferencedAtTypeLocation(symbol);
if (symbolAllowedAsType || isTypeOnly) {
return symbolAllowedAsType;
}
if (isTypeOnly) {
// It's a type, but you can reach it by namespace.type as well
return symbolCanBeReferencedAtTypeLocation(symbol);
}
}
@ -1221,7 +1219,11 @@ namespace ts.Completions {
}
function isTypeOnlyCompletion(): boolean {
return insideJsDocTagTypeExpression || !isContextTokenValueLocation(contextToken) && (isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken));
return insideJsDocTagTypeExpression
|| !isContextTokenValueLocation(contextToken) &&
(isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker)
|| isPartOfTypeNode(location)
|| isContextTokenTypeLocation(contextToken));
}
function isContextTokenValueLocation(contextToken: Node) {
@ -2060,16 +2062,18 @@ namespace ts.Completions {
case KeywordCompletionFilters.None:
return false;
case KeywordCompletionFilters.All:
return kind === SyntaxKind.AsyncKeyword || SyntaxKind.AwaitKeyword || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === SyntaxKind.DeclareKeyword || kind === SyntaxKind.ModuleKeyword
return isFunctionLikeBodyKeyword(kind)
|| kind === SyntaxKind.DeclareKeyword
|| kind === SyntaxKind.ModuleKeyword
|| isTypeKeyword(kind) && kind !== SyntaxKind.UndefinedKeyword;
case KeywordCompletionFilters.FunctionLikeBodyKeywords:
return isFunctionLikeBodyKeyword(kind);
case KeywordCompletionFilters.ClassElementKeywords:
return isClassMemberCompletionKeyword(kind);
case KeywordCompletionFilters.InterfaceElementKeywords:
return isInterfaceOrTypeLiteralCompletionKeyword(kind);
case KeywordCompletionFilters.ConstructorParameterKeywords:
return isParameterPropertyModifier(kind);
case KeywordCompletionFilters.FunctionLikeBodyKeywords:
return isFunctionLikeBodyKeyword(kind);
case KeywordCompletionFilters.TypeAssertionKeywords:
return isTypeKeyword(kind) || kind === SyntaxKind.ConstKeyword;
case KeywordCompletionFilters.TypeKeywords:
@ -2132,7 +2136,9 @@ namespace ts.Completions {
}
function isFunctionLikeBodyKeyword(kind: SyntaxKind) {
return kind === SyntaxKind.AsyncKeyword || kind === SyntaxKind.AwaitKeyword || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
return kind === SyntaxKind.AsyncKeyword
|| kind === SyntaxKind.AwaitKeyword
|| !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
}
function keywordForNode(node: Node): SyntaxKind {

View File

@ -1470,5 +1470,22 @@ var x = 10;`
openFilesForSession([{ file, projectRootPath }], session);
}
});
it("assert when removing project", () => {
const host = createServerHost([commonFile1, commonFile2, libFile]);
const service = createProjectService(host);
service.openClientFile(commonFile1.path);
const project = service.inferredProjects[0];
checkProjectActualFiles(project, [commonFile1.path, libFile.path]);
// Intentionally create scriptinfo and attach it to project
const info = service.getOrCreateScriptInfoForNormalizedPath(commonFile2.path as server.NormalizedPath, /*openedByClient*/ false)!;
info.attachToProject(project);
try {
service.applyChangesInOpenFiles(/*openFiles*/ undefined, /*changedFiles*/ undefined, [commonFile1.path]);
}
catch (e) {
assert.isTrue(e.message.indexOf("Debug Failure. False expression: Found script Info still attached to project") === 0);
}
});
});
}

View File

@ -5,16 +5,11 @@ Rush Multi-Project Build Tool 5.10.1 - https://rushjs.io
Starting "rush rebuild"
Executing a maximum of 1 simultaneous processes...
[@azure/cosmos] started
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @azure/cosmos@X.X.X compile: `echo Using TypeScript && tsc --version && tsc -p tsconfig.prod.json --pretty`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @azure/cosmos@X.X.X compile script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-07-15T13_35_10_789Z-debug.log
XX of XX: [@azure/cosmos] completed successfully in ? seconds
[@azure/event-processor-host] started
XX of XX: [@azure/event-processor-host] completed successfully in ? seconds
[@azure/service-bus] started
Warning: You have changed the public API signature for this project. Updating review/service-bus.api.md
[@azure/storage-blob] started
XX of XX: [@azure/storage-blob] completed successfully in ? seconds
[@azure/storage-file] started
@ -23,6 +18,8 @@ XX of XX: [@azure/storage-file] completed successfully in ? seconds
XX of XX: [@azure/storage-queue] completed successfully in ? seconds
[@azure/template] started
XX of XX: [@azure/template] completed successfully in ? seconds
[testhub] started
XX of XX: [testhub] completed successfully in ? seconds
[@azure/abort-controller] started
XX of XX: [@azure/abort-controller] completed successfully in ? seconds
[@azure/core-asynciterator-polyfill] started
@ -38,7 +35,7 @@ npm ERR!
npm ERR! Failed at the @azure/core-http@X.X.X-preview.1 build:tsc script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-07-15T13_36_24_862Z-debug.log
npm ERR! /root/.npm/_logs/2019-07-19T13_40_31_496Z-debug.log
ERROR: "build:tsc" exited with 2.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
@ -48,20 +45,17 @@ npm ERR!
npm ERR! Failed at the @azure/core-http@X.X.X-preview.1 build:lib script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-07-15T13_36_24_938Z-debug.log
npm ERR! /root/.npm/_logs/2019-07-19T13_40_31_533Z-debug.log
ERROR: "build:lib" exited with 1.
[@azure/core-paging] started
XX of XX: [@azure/core-paging] completed successfully in ? seconds
[@azure/event-processor-host] started
XX of XX: [@azure/event-processor-host] completed successfully in ? seconds
[testhub] started
XX of XX: [testhub] completed successfully in ? seconds
SUCCESS (10)
SUCCESS (11)
================================
@azure/abort-controller (? seconds)
@azure/core-asynciterator-polyfill (? seconds)
@azure/core-auth (? seconds)
@azure/core-paging (? seconds)
@azure/cosmos (? seconds)
@azure/event-processor-host (? seconds)
@azure/storage-blob (? seconds)
@azure/storage-file (? seconds)
@ -69,6 +63,11 @@ SUCCESS (10)
@azure/template (? seconds)
testhub (? seconds)
================================
SUCCESS WITH WARNINGS (1)
================================
@azure/service-bus (? seconds)
Warning: You have changed the public API signature for this project. Updating review/service-bus.api.md
================================
BLOCKED (7)
================================
@azure/core-amqp
@ -79,7 +78,7 @@ BLOCKED (7)
@azure/keyvault-keys
@azure/keyvault-secrets
================================
FAILURE (3)
FAILURE (1)
================================
@azure/core-http (? seconds)
npm ERR! code ELIFECYCLE
@ -90,7 +89,7 @@ npm ERR!
npm ERR! Failed at the @azure/core-http@X.X.X-preview.1 build:tsc script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-07-15T13_36_24_862Z-debug.log
npm ERR! /root/.npm/_logs/2019-07-19T13_40_31_496Z-debug.log
ERROR: "build:tsc" exited with 2.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
@ -100,24 +99,8 @@ npm ERR!
npm ERR! Failed at the @azure/core-http@X.X.X-preview.1 build:lib script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-07-15T13_36_24_938Z-debug.log
npm ERR! /root/.npm/_logs/2019-07-19T13_40_31_533Z-debug.log
ERROR: "build:lib" exited with 1.
@azure/cosmos ( ? seconds)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @azure/cosmos@X.X.X compile: `echo Using TypeScript && tsc --version && tsc -p tsconfig.prod.json --pretty`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @azure/cosmos@X.X.X compile script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-07-15T13_35_10_789Z-debug.log
@azure/service-bus ( ? seconds)
>>> @azure/service-bus
tsc -p . && rollup -c 2>&1 && npm run extract-api
error TS2318: Cannot find global type 'AsyncGenerator'.
src/receiver.ts(193,32): error TS2739: Type '{}' is missing the following properties from type 'AsyncIterableIterator<ServiceBusMessage>': [Symbol.asyncIterator], next
src/receiver.ts(742,32): error TS2322: Type '{}' is not assignable to type 'AsyncIterableIterator<ServiceBusMessage>'.
================================
Error: Project(s) failed to build
rush rebuild - Errors! ( ? seconds)
@ -126,8 +109,7 @@ rush rebuild - Errors! ( ? seconds)
Standard error:
Your version of Node.js (X.X.X) has not been tested with this release of Rush. The Rush team will not accept issue reports for it. Please consider upgrading Rush or downgrading Node.js.
XX of XX: [@azure/cosmos] failed to build!
XX of XX: [@azure/service-bus] failed to build!
XX of XX: [@azure/service-bus] completed with warnings in ? seconds
XX of XX: [@azure/core-http] failed to build!
XX of XX: [@azure/core-arm] blocked by [@azure/core-http]!
XX of XX: [@azure/identity] blocked by [@azure/core-http]!
@ -137,5 +119,3 @@ XX of XX: [@azure/keyvault-certificates] blocked by [@azure/core-http]!
XX of XX: [@azure/keyvault-keys] blocked by [@azure/core-http]!
XX of XX: [@azure/keyvault-secrets] blocked by [@azure/core-http]!
[@azure/core-http] Returned error code: 1
[@azure/cosmos] Returned error code: 2
[@azure/service-bus] Returned error code: 2

View File

@ -12,11 +12,11 @@ XX of XX: [@uifabric/tslint-rules] completed successfully in ? seconds
ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
PASS src/__tests__/codepenTransform.test.ts
codepen transform
✓ handles examples with function components (225ms)
✓ handles examples with function components (256ms)
✓ handles examples with class components (38ms)
✓ handles examples importing exampleData (115ms)
✓ handles examples importing TestImages (45ms)
✓ handles examples importing PeopleExampleData (288ms)
✓ handles examples importing exampleData (125ms)
✓ handles examples importing TestImages (33ms)
✓ handles examples importing PeopleExampleData (270ms)
Test Suites: 1 passed, 1 total
Tests: 5 passed, 5 total
Snapshots: 4 passed, 4 total
@ -246,11 +246,11 @@ SUCCESS WITH WARNINGS (5)
ts-jest[versions] (WARN) Version X.X.X-insiders.xxxxxxxx of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
PASS src/__tests__/codepenTransform.test.ts
codepen transform
✓ handles examples with function components (225ms)
✓ handles examples with function components (256ms)
✓ handles examples with class components (38ms)
✓ handles examples importing exampleData (115ms)
✓ handles examples importing TestImages (45ms)
✓ handles examples importing PeopleExampleData (288ms)
✓ handles examples importing exampleData (125ms)
✓ handles examples importing TestImages (33ms)
✓ handles examples importing PeopleExampleData (270ms)
Test Suites: 1 passed, 1 total
Tests: 5 passed, 5 total
Snapshots: 4 passed, 4 total

View File

@ -30,7 +30,7 @@ node_modules/adonis-framework/src/Encryption/index.js(87,15): error TS2304: Cann
node_modules/adonis-framework/src/Encryption/index.js(101,21): error TS2769: No overload matches this call.
Overload 1 of 4, '(data: Binary, input_encoding: undefined, output_encoding: Utf8AsciiBinaryEncoding): string', gave the following error.
Argument of type '"base64"' is not assignable to parameter of type 'undefined'.
Overload 2 of 4, '(data: string, input_encoding: "binary" | "base64" | "hex" | undefined, output_encoding: Utf8AsciiBinaryEncoding): string', gave the following error.
Overload 2 of 4, '(data: string, input_encoding: "base64" | "binary" | "hex" | undefined, output_encoding: Utf8AsciiBinaryEncoding): string', gave the following error.
Argument of type 'string' is not assignable to parameter of type 'Utf8AsciiBinaryEncoding'.
node_modules/adonis-framework/src/Encryption/index.js(114,15): error TS2304: Cannot find name 'Mixed'.
node_modules/adonis-framework/src/Encryption/index.js(119,23): error TS2554: Expected 2 arguments, but got 1.

View File

@ -6501,7 +6501,8 @@ node_modules/chrome-devtools-frontend/front_end/formatter_worker/acorn/acorn_loo
node_modules/chrome-devtools-frontend/front_end/formatter_worker/acorn/acorn_loose.js(258,55): error TS2339: Property 'end' does not exist on type 'true'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/acorn/acorn_loose.js(1365,5): error TS2339: Property 'next' does not exist on type 'LooseParser'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/acorn/acorn_loose.js(1366,12): error TS2339: Property 'parseTopLevel' does not exist on type 'LooseParser'.
node_modules/chrome-devtools-frontend/front_end/har_importer/HARImporter.js(26,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'page' must be of type 'any', but here has type 'HARPage'.
node_modules/chrome-devtools-frontend/front_end/har_importer/HARImporter.js(16,32): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
node_modules/chrome-devtools-frontend/front_end/har_importer/HARImporter.js(16,52): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
node_modules/chrome-devtools-frontend/front_end/har_importer/HARImporter.js(46,5): error TS2322: Type 'Date' is not assignable to type 'number'.
node_modules/chrome-devtools-frontend/front_end/heap_profiler_test_runner/HeapProfilerTestRunner.js(320,70): error TS2339: Property 'heap_profiler' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/heap_profiler_test_runner/HeapProfilerTestRunner.js(321,35): error TS2339: Property 'heap_profiler' does not exist on type 'any[]'.

View File

@ -382,8 +382,6 @@ node_modules/lodash/nthArg.js(28,26): error TS2345: Argument of type 'number | u
node_modules/lodash/omit.js(48,32): error TS2345: Argument of type 'number' is not assignable to parameter of type 'boolean'.
node_modules/lodash/orderBy.js(18,10): error TS1003: Identifier expected.
node_modules/lodash/orderBy.js(18,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name.
node_modules/lodash/org.js(8,22): error TS2307: Cannot find module 'moment'.
node_modules/lodash/org.js(9,19): error TS2307: Cannot find module 'ncp'.
node_modules/lodash/parseInt.js(24,10): error TS1003: Identifier expected.
node_modules/lodash/parseInt.js(24,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name.
node_modules/lodash/partial.js(48,9): error TS2339: Property 'placeholder' does not exist on type 'Function'.

View File

@ -8,9 +8,9 @@ node_modules/npmlog/log.js(194,37): error TS2345: Argument of type 'any[]' is no
Property '0' is missing in type 'any[]' but required in type '[any, ...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 TS2769: No overload matches this call.
Overload 1 of 2, '(buffer: string | Uint8Array | Buffer, cb?: ((err?: Error | null | undefined) => void) | undefined): boolean', gave the following error.
Argument of type 'string | undefined' is not assignable to parameter of type 'string | Uint8Array | Buffer'.
Type 'undefined' is not assignable to type 'string | Uint8Array | Buffer'.
Overload 1 of 2, '(buffer: string | Uint8Array, cb?: ((err?: Error | null | undefined) => void) | undefined): boolean', gave the following error.
Argument of type 'string | undefined' is not assignable to parameter of type 'string | Uint8Array'.
Type 'undefined' is not assignable to type 'string | Uint8Array'.
Overload 2 of 2, '(str: string, encoding?: string | undefined, cb?: ((err?: Error | null | undefined) => void) | undefined): boolean', gave the following error.
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.

View File

@ -0,0 +1,27 @@
/// <reference path='fourslash.ts'/>
//// class Foo<T> { }
//// class Bar { }
//// function includesTypes() {
//// new Foo</*1*/
//// }
//// function excludesTypes1() {
//// new Bar</*2*/
//// }
//// function excludesTypes2() {
//// 1</*3*/
//// }
verify.completions(
{
marker: ["1"],
includes: [
{ name: "string", sortText: completion.SortText.GlobalsOrKeywords },
{ name: "String", sortText: completion.SortText.GlobalsOrKeywords },
],
},
{
marker: ["2", "3"],
excludes: ["string"]
}
);

View File

@ -8,14 +8,14 @@
////f</*1b*/T/*2b*/y/*3b*/;
////f</*1c*/T/*2c*/y/*3c*/>
////f</*1d*/T/*2d*/y/*3d*/>
////f</*1eTypeOnly*/T/*2eTypeOnly*/y/*3eTypeOnly*/>();
////f</*1e*/T/*2e*/y/*3e*/>();
////
////f2</*1k*/T/*2k*/y/*3k*/,
////f2</*1l*/T/*2l*/y/*3l*/,{| "newId": true |}T{| "newId": true |}y{| "newId": true |}
////f2</*1m*/T/*2m*/y/*3m*/,{| "newId": true |}T{| "newId": true |}y{| "newId": true |};
////f2</*1n*/T/*2n*/y/*3n*/,{| "newId": true |}T{| "newId": true |}y{| "newId": true |}>
////f2</*1o*/T/*2o*/y/*3o*/,{| "newId": true |}T{| "newId": true |}y{| "newId": true |}>
////f2</*1pTypeOnly*/T/*2pTypeOnly*/y/*3pTypeOnly*/,{| "newId": true, "typeOnly": true |}T{| "newId": true, "typeOnly": true |}y{| "newId": true, "typeOnly": true |}>();
////f2</*1p*/T/*2p*/y/*3p*/,{| "newId": true, "typeOnly": true |}T{| "newId": true, "typeOnly": true |}y{| "newId": true, "typeOnly": true |}>();
////
////f2<typeof /*1uValueOnly*/x, {| "newId": true |}T{| "newId": true |}y{| "newId": true |}
////
@ -25,12 +25,11 @@
goTo.eachMarker(marker => {
const markerName = test.markerName(marker) || "";
const typeOnly = markerName.endsWith("TypeOnly") || marker.data && marker.data.typeOnly;
const valueOnly = markerName.endsWith("ValueOnly");
verify.completions({
marker,
includes: typeOnly ? "Type" : valueOnly ? "x" : ["Type", "x"],
excludes: typeOnly ? "x" : valueOnly ? "Type" : [],
includes: valueOnly ? "x" : "Type",
excludes: valueOnly ? "Type" : "x",
isNewIdentifierLocation: marker.data && marker.data.newId || false,
});
});

View File

@ -48,5 +48,5 @@ verify.completions(
{ marker: "13", exact: globals, isGlobalCompletion: false },
{ marker: "15", exact: globals, isGlobalCompletion: true, isNewIdentifierLocation: true },
{ marker: "16", exact: [...x, completion.globalThisEntry, ...completion.globalsVars, completion.undefinedVarEntry], isGlobalCompletion: false },
{ marker: "17", exact: completion.globalKeywordsPlusUndefined, isGlobalCompletion: false },
{ marker: "17", exact: completion.globalKeywords, isGlobalCompletion: false },
);

View File

@ -9,25 +9,22 @@
////x + {| "valueOnly": true |}
////x < {| "valueOnly": true |}
////f < {| "valueOnly": true |}
////g < {| "valueOnly": false |}
////const something: C<{| "typeOnly": true |};
////const something2: C<C<{| "typeOnly": true |};
////new C<{| "valueOnly": false |};
////new C<C<{| "valueOnly": false |};
////g < /*g*/
////const something: C</*something*/;
////const something2: C<C</*something2*/;
////new C</*C*/;
////new C<C</*CC*/;
////
////declare const callAndConstruct: { new<T>(): callAndConstruct<T>; <T>(): string; };
////interface callAndConstruct<T> {}
////new callAndConstruct<callAndConstruct</*callAndConstruct*/
for (const marker of test.markers()) {
if (marker.data && marker.data.typeOnly) {
verify.completions({ marker, includes: "T", excludes: "x" });
}
else if (marker.data && marker.data.valueOnly) {
if (marker.data && marker.data.valueOnly) {
verify.completions({ marker, includes: "x", excludes: "T" });
}
else {
verify.completions({ marker, includes: ["x", "T"] });
verify.completions({ marker, includes: "T", excludes: "x" });
}
}

View File

@ -685,7 +685,6 @@ declare namespace completion {
export const globalInJsKeywords: ReadonlyArray<Entry>;
export const insideMethodKeywords: ReadonlyArray<Entry>;
export const insideMethodInJsKeywords: ReadonlyArray<Entry>;
export const globalKeywordsPlusUndefined: ReadonlyArray<Entry>;
export const globalsVars: ReadonlyArray<Entry>;
export function globalsInsideFunction(plus: ReadonlyArray<Entry>): ReadonlyArray<Entry>;
export function globalsInJsInsideFunction(plus: ReadonlyArray<Entry>): ReadonlyArray<Entry>;

@ -1 +1 @@
Subproject commit 1e471a007968b7490563b91ed6909ae6046f3fe8
Subproject commit 7f938c71ffda293eb1b69adf8bd12b7c11f9113b