Merge branch 'master' into master-dynamicImport

This commit is contained in:
Yui T
2017-03-09 19:11:25 -08:00
24 changed files with 1198 additions and 90 deletions
+6 -6
View File
@@ -422,7 +422,7 @@ compileFile(buildProtocolJs,
[buildProtocolTs],
[],
/*useBuiltCompiler*/ false,
{noOutFile: true});
{ noOutFile: true, lib: "es6" });
file(buildProtocolDts, [buildProtocolTs, buildProtocolJs, typescriptServicesDts], function() {
@@ -584,16 +584,16 @@ compileFile(
file(typescriptServicesDts, [servicesFile]);
var cancellationTokenFile = path.join(builtLocalDirectory, "cancellationToken.js");
compileFile(cancellationTokenFile, cancellationTokenSources, [builtLocalDirectory].concat(cancellationTokenSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { outDir: builtLocalDirectory, noOutFile: true });
compileFile(cancellationTokenFile, cancellationTokenSources, [builtLocalDirectory].concat(cancellationTokenSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], outDir: builtLocalDirectory, noOutFile: true, lib: "es6" });
var typingsInstallerFile = path.join(builtLocalDirectory, "typingsInstaller.js");
compileFile(typingsInstallerFile, typingsInstallerSources, [builtLocalDirectory].concat(typingsInstallerSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { outDir: builtLocalDirectory, noOutFile: false });
compileFile(typingsInstallerFile, typingsInstallerSources, [builtLocalDirectory].concat(typingsInstallerSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], outDir: builtLocalDirectory, noOutFile: false, lib: "es6,scripthost" });
var watchGuardFile = path.join(builtLocalDirectory, "watchGuard.js");
compileFile(watchGuardFile, watchGuardSources, [builtLocalDirectory].concat(watchGuardSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { outDir: builtLocalDirectory, noOutFile: false });
compileFile(watchGuardFile, watchGuardSources, [builtLocalDirectory].concat(watchGuardSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], outDir: builtLocalDirectory, noOutFile: false, lib: "es6" });
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
compileFile(serverFile, serverSources, [builtLocalDirectory, copyright, cancellationTokenFile, typingsInstallerFile, watchGuardFile].concat(serverSources).concat(servicesSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], preserveConstEnums: true });
compileFile(serverFile, serverSources, [builtLocalDirectory, copyright, cancellationTokenFile, typingsInstallerFile, watchGuardFile].concat(serverSources).concat(servicesSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], preserveConstEnums: true, lib: "es6,scripthost" });
var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
compileFile(
@@ -717,7 +717,7 @@ compileFile(
/*prereqs*/[builtLocalDirectory, tscFile].concat(libraryTargets).concat(servicesSources).concat(harnessSources),
/*prefixes*/[],
/*useBuiltCompiler:*/ true,
/*opts*/ { inlineSourceMap: true, types: ["node", "mocha", "chai"] });
/*opts*/ { inlineSourceMap: true, types: ["node", "mocha", "chai"], lib: "es6,scripthost" });
var internalTests = "internal/";
+33 -16
View File
@@ -3973,7 +3973,7 @@ namespace ts {
return true;
}
if (type.flags & TypeFlags.TypeVariable) {
const constraint = getBaseConstraintOfType(<TypeVariable>type);
const constraint = getBaseConstraintOfType(type);
return constraint && isValidBaseType(constraint) && isMixinConstructorType(constraint);
}
return false;
@@ -4989,16 +4989,32 @@ namespace ts {
}
function getConstraintOfType(type: TypeVariable | UnionOrIntersectionType): Type {
return type.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(<TypeParameter>type) : getBaseConstraintOfType(type);
return type.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(<TypeParameter>type) :
type.flags & TypeFlags.IndexedAccess ? getConstraintOfIndexedAccess(<IndexedAccessType>type) :
getBaseConstraintOfType(type);
}
function getConstraintOfTypeParameter(typeParameter: TypeParameter): Type {
return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined;
}
function getBaseConstraintOfType(type: TypeVariable | UnionOrIntersectionType): Type {
const constraint = getResolvedBaseConstraint(type);
return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined;
function getConstraintOfIndexedAccess(type: IndexedAccessType) {
const baseObjectType = getBaseConstraintOfType(type.objectType);
const baseIndexType = getBaseConstraintOfType(type.indexType);
return baseObjectType || baseIndexType ? getIndexedAccessType(baseObjectType || type.objectType, baseIndexType || type.indexType) : undefined;
}
function getBaseConstraintOfType(type: Type): Type {
if (type.flags & (TypeFlags.TypeVariable | TypeFlags.UnionOrIntersection)) {
const constraint = getResolvedBaseConstraint(<TypeVariable | UnionOrIntersectionType>type);
if (constraint !== noConstraintType && constraint !== circularConstraintType) {
return constraint;
}
}
else if (type.flags & TypeFlags.Index) {
return stringType;
}
return undefined;
}
function hasNonCircularBaseConstraint(type: TypeVariable): boolean {
@@ -5096,7 +5112,7 @@ namespace ts {
* type itself. Note that the apparent type of a union type is the union type itself.
*/
function getApparentType(type: Type): Type {
const t = type.flags & TypeFlags.TypeVariable ? getBaseConstraintOfType(<TypeVariable>type) || emptyObjectType : type;
const t = type.flags & TypeFlags.TypeVariable ? getBaseConstraintOfType(type) || emptyObjectType : type;
return t.flags & TypeFlags.Intersection ? getApparentTypeOfIntersectionType(<IntersectionType>t) :
t.flags & TypeFlags.StringLike ? globalStringType :
t.flags & TypeFlags.NumberLike ? globalNumberType :
@@ -7921,7 +7937,7 @@ namespace ts {
}
// A type S is related to a type T[K] if S is related to A[K], where K is string-like and
// A is the apparent type of S.
const constraint = getBaseConstraintOfType(<IndexedAccessType>target);
const constraint = getBaseConstraintOfType(target);
if (constraint) {
if (result = isRelatedTo(source, constraint, reportErrors)) {
errorInfo = saveErrorInfo;
@@ -7961,7 +7977,7 @@ namespace ts {
else if (source.flags & TypeFlags.IndexedAccess) {
// A type S[K] is related to a type T if A[K] is related to T, where K is string-like and
// A is the apparent type of S.
const constraint = getBaseConstraintOfType(<IndexedAccessType>source);
const constraint = getConstraintOfType(<IndexedAccessType>source);
if (constraint) {
if (result = isRelatedTo(constraint, target, reportErrors)) {
errorInfo = saveErrorInfo;
@@ -9184,13 +9200,14 @@ namespace ts {
}
}
function createInferenceContext(signature: Signature, inferUnionTypes: boolean): InferenceContext {
function createInferenceContext(signature: Signature, inferUnionTypes: boolean, useAnyForNoInferences: boolean): InferenceContext {
const inferences = map(signature.typeParameters, createTypeInferencesObject);
return {
signature,
inferUnionTypes,
inferences,
inferredTypes: new Array(signature.typeParameters.length),
useAnyForNoInferences
};
}
@@ -9604,7 +9621,7 @@ namespace ts {
getInferenceMapper(context)));
}
else {
inferredType = emptyObjectType;
inferredType = context.useAnyForNoInferences ? anyType : emptyObjectType;
}
inferenceSucceeded = true;
@@ -9873,7 +9890,7 @@ namespace ts {
return strictNullChecks ? TypeFacts.ObjectStrictFacts : TypeFacts.ObjectFacts;
}
if (flags & TypeFlags.TypeVariable) {
return getTypeFacts(getBaseConstraintOfType(<TypeVariable>type) || emptyObjectType);
return getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType);
}
if (flags & TypeFlags.UnionOrIntersection) {
return getTypeFactsOfTypes((<UnionOrIntersectionType>type).types);
@@ -10685,7 +10702,7 @@ namespace ts {
return targetType;
}
if (type.flags & TypeFlags.TypeVariable) {
const constraint = getBaseConstraintOfType(<TypeVariable>type) || anyType;
const constraint = getBaseConstraintOfType(type) || anyType;
if (isTypeSubtypeOf(targetType, constraint)) {
return getIntersectionType([type, targetType]);
}
@@ -13652,7 +13669,7 @@ namespace ts {
// Instantiate a generic signature in the context of a non-generic signature (section 3.8.5 in TypeScript spec)
function instantiateSignatureInContextOf(signature: Signature, contextualSignature: Signature, contextualMapper: TypeMapper): Signature {
const context = createInferenceContext(signature, /*inferUnionTypes*/ true);
const context = createInferenceContext(signature, /*inferUnionTypes*/ true, /*useAnyForNoInferences*/ false);
forEachMatchingParameterType(contextualSignature, signature, (source, target) => {
// Type parameters from outer context referenced by source type are fixed by instantiation of the source type
inferTypesWithContext(context, instantiateType(source, contextualMapper), target);
@@ -14353,7 +14370,7 @@ namespace ts {
let candidate: Signature;
let typeArgumentsAreValid: boolean;
const inferenceContext = originalCandidate.typeParameters
? createInferenceContext(originalCandidate, /*inferUnionTypes*/ false)
? createInferenceContext(originalCandidate, /*inferUnionTypes*/ false, /*useAnyForNoInferences*/ isInJavaScriptFile(node))
: undefined;
while (true) {
@@ -16233,7 +16250,7 @@ namespace ts {
function isLiteralContextualType(contextualType: Type) {
if (contextualType) {
if (contextualType.flags & TypeFlags.TypeVariable) {
const constraint = getBaseConstraintOfType(<TypeVariable>contextualType) || emptyObjectType;
const constraint = getBaseConstraintOfType(contextualType) || emptyObjectType;
// If the type parameter is constrained to the base primitive type we're checking for,
// consider this a literal context. For example, given a type parameter 'T extends string',
// this causes us to infer string literal types for T.
@@ -17123,7 +17140,7 @@ namespace ts {
// Check if we're indexing with a numeric type and the object type is a generic
// type with a constraint that has a numeric index signature.
if (maybeTypeOfKind(objectType, TypeFlags.TypeVariable) && isTypeOfKind(indexType, TypeFlags.NumberLike)) {
const constraint = getBaseConstraintOfType(<TypeVariable | UnionOrIntersectionType>objectType);
const constraint = getBaseConstraintOfType(objectType);
if (constraint && getIndexInfoOfType(constraint, IndexKind.Number)) {
return type;
}
+1
View File
@@ -3240,6 +3240,7 @@ namespace ts {
mapper?: TypeMapper; // Type mapper for this inference context
failedTypeParameterIndex?: number; // Index of type parameter for which inference failed
// It is optional because in contextual signature instantiation, nothing fails
useAnyForNoInferences?: boolean; // Use any instead of {} for no inferences
}
/* @internal */
+5 -4
View File
@@ -2248,22 +2248,23 @@ namespace FourSlash {
if (expected === undefined) {
if (actual) {
this.raiseError(name + " failed - expected no template but got {newText: \"" + actual.newText + "\" caretOffset: " + actual.caretOffset + "}");
this.raiseError(`${name} failed - expected no template but got {newText: "${actual.newText}", caretOffset: ${actual.caretOffset}}`);
}
return;
}
else {
if (actual === undefined) {
this.raiseError(name + " failed - expected the template {newText: \"" + actual.newText + "\" caretOffset: " + actual.caretOffset + "} but got nothing instead");
this.raiseError(`${name} failed - expected the template {newText: "${expected.newText}", caretOffset: "${expected.caretOffset}"} but got nothing instead`);
}
if (actual.newText !== expected.newText) {
this.raiseError(name + " failed - expected insertion:\n" + this.clarifyNewlines(expected.newText) + "\nactual insertion:\n" + this.clarifyNewlines(actual.newText));
this.raiseError(`${name} failed - expected insertion:\n"${this.clarifyNewlines(expected.newText)}"\nactual insertion:\n"${this.clarifyNewlines(actual.newText)}"`);
}
if (actual.caretOffset !== expected.caretOffset) {
this.raiseError(name + " failed - expected caretOffset: " + expected.caretOffset + ",\nactual caretOffset:" + actual.caretOffset);
this.raiseError(`${name} failed - expected caretOffset: ${expected.caretOffset}\nactual caretOffset:${actual.caretOffset}`);
}
}
}
+4
View File
@@ -6,6 +6,10 @@
"declaration": false,
"types": [
"node", "mocha", "chai"
],
"lib": [
"es6",
"scripthost"
]
},
"files": [
-1
View File
@@ -1,7 +1,6 @@
/// <reference path="..\compiler\commandLineParser.ts" />
/// <reference path="..\services\services.ts" />
/// <reference path="session.ts" />
/// <reference types="node" />
namespace ts.server {
@@ -5,6 +5,9 @@
"module": "commonjs",
"types": [
"node"
],
"lib": [
"es6"
]
},
"files": [
+38 -27
View File
@@ -131,6 +131,14 @@ namespace ts.server {
constructor(private readonly logFilename: string,
private readonly traceToConsole: boolean,
private readonly level: LogLevel) {
if (this.logFilename) {
try {
this.fd = fs.openSync(this.logFilename, "w");
}
catch(_) {
// swallow the error and keep logging disabled if file cannot be opened
}
}
}
static padStringRight(str: string, padding: string) {
@@ -175,11 +183,6 @@ namespace ts.server {
}
msg(s: string, type: Msg.Types = Msg.Err) {
if (this.fd < 0) {
if (this.logFilename) {
this.fd = fs.openSync(this.logFilename, "w");
}
}
if (this.fd >= 0 || this.traceToConsole) {
s = s + "\n";
const prefix = Logger.padStringRight(type + " " + this.seq.toString(), " ");
@@ -410,6 +413,9 @@ namespace ts.server {
}
function parseLoggingEnvironmentString(logEnvStr: string): LogOptions {
if (!logEnvStr) {
return {};
}
const logEnv: LogOptions = { logToFile: true };
const args = logEnvStr.split(" ");
const len = args.length - 1;
@@ -422,8 +428,8 @@ namespace ts.server {
logEnv.file = stripQuotes(value);
break;
case "-level":
const level: LogLevel = (<any>LogLevel)[value];
logEnv.detailLevel = typeof level === "number" ? level : LogLevel.normal;
const level = getLogLevel(value);
logEnv.detailLevel = level !== undefined ? level : LogLevel.normal;
break;
case "-traceToConsole":
logEnv.traceToConsole = value.toLowerCase() === "true";
@@ -437,28 +443,32 @@ namespace ts.server {
return logEnv;
}
// TSS_LOG "{ level: "normal | verbose | terse", file?: string}"
function createLoggerFromEnv() {
let fileName: string = undefined;
let detailLevel = LogLevel.normal;
let traceToConsole = false;
const logEnvStr = process.env["TSS_LOG"];
if (logEnvStr) {
const logEnv = parseLoggingEnvironmentString(logEnvStr);
if (logEnv.logToFile) {
if (logEnv.file) {
fileName = logEnv.file;
}
else {
fileName = __dirname + "/.log" + process.pid.toString();
function getLogLevel(level: string) {
if (level) {
const l = level.toLowerCase();
for (const name in LogLevel) {
if (isNaN(+name) && l === name.toLowerCase()) {
return <LogLevel><any>LogLevel[name];
}
}
if (logEnv.detailLevel) {
detailLevel = logEnv.detailLevel;
}
traceToConsole = logEnv.traceToConsole;
}
return new Logger(fileName, traceToConsole, detailLevel);
return undefined;
}
// TSS_LOG "{ level: "normal | verbose | terse", file?: string}"
function createLogger() {
const cmdLineLogFileName = findArgument("--logFile");
const cmdLineVerbosity = getLogLevel(findArgument("--logVerbosity"));
const envLogOptions = parseLoggingEnvironmentString(process.env["TSS_LOG"]);
const logFileName = cmdLineLogFileName
? stripQuotes(cmdLineLogFileName)
: envLogOptions.logToFile
? envLogOptions.file || (__dirname + "/.log" + process.pid.toString())
: undefined;
const logVerbosity = cmdLineVerbosity || envLogOptions.detailLevel;
return new Logger(logFileName, envLogOptions.traceToConsole, logVerbosity)
}
// This places log file in the directory containing editorServices.js
// TODO: check that this location is writable
@@ -555,7 +565,6 @@ namespace ts.server {
// to increase the chunk size or decrease the interval
// time dynamically to match the large reference set?
const pollingWatchedFileSet = createPollingWatchedFileSet();
const logger = createLoggerFromEnv();
const pending: Buffer[] = [];
let canWrite = true;
@@ -607,6 +616,8 @@ namespace ts.server {
return s.length > 2 && s.charCodeAt(0) === CharacterCodes.slash && s.charCodeAt(1) === CharacterCodes.slash;
}
const logger = createLogger();
const sys = <ServerHost>ts.sys;
// use watchGuard process on Windows when node version is 4 or later
const useWatchGuard = process.platform === "win32" && getNodeMajorVersion() >= 4;
+2 -1
View File
@@ -10,7 +10,8 @@
"target": "es5",
"noUnusedLocals": true,
"noUnusedParameters": true,
"declaration": true
"declaration": true,
"types": []
},
"files": [
"editorServices.ts",
@@ -13,14 +13,20 @@ namespace ts.server.typingsInstaller {
} = require("path");
class FileLog implements Log {
private logEnabled = true;
constructor(private readonly logFile?: string) {
}
isEnabled() {
return this.logFile !== undefined;
return this.logEnabled && this.logFile !== undefined;
}
writeLine(text: string) {
fs.appendFileSync(this.logFile, text + sys.newLine);
try {
fs.appendFileSync(this.logFile, text + sys.newLine);
}
catch(e) {
this.logEnabled = false;
}
}
}
@@ -5,6 +5,10 @@
"outFile": "../../../built/local/typingsInstaller.js",
"types": [
"node"
],
"lib": [
"es6",
"scripthost"
]
},
"files": [
+8 -2
View File
@@ -1,8 +1,14 @@
{
"extends": "../../tsconfig-base",
"extends": "../../tsconfig-base",
"compilerOptions": {
"removeComments": true,
"outFile": "../../../built/local/watchGuard.js"
"outFile": "../../../built/local/watchGuard.js",
"types": [
"node"
],
"lib": [
"es6"
]
},
"files": [
"watchGuard.ts"
+15 -6
View File
@@ -447,8 +447,8 @@ namespace ts.Completions {
return undefined;
}
const { parent, kind } = contextToken;
if (kind === SyntaxKind.DotToken) {
let parent = contextToken.parent;
if (contextToken.kind === SyntaxKind.DotToken) {
if (parent.kind === SyntaxKind.PropertyAccessExpression) {
node = (<PropertyAccessExpression>contextToken.parent).expression;
isRightOfDot = true;
@@ -464,16 +464,24 @@ namespace ts.Completions {
}
}
else if (sourceFile.languageVariant === LanguageVariant.JSX) {
switch (contextToken.parent.kind) {
// <UI.Test /* completion position */ />
// If the tagname is a property access expression, we will then walk up to the top most of property access expression.
// Then, try to get a JSX container and its associated attributes type.
if (parent && parent.kind === SyntaxKind.PropertyAccessExpression) {
contextToken = parent;
parent = parent.parent;
}
switch (parent.kind) {
case SyntaxKind.JsxClosingElement:
if (kind === SyntaxKind.SlashToken) {
if (contextToken.kind === SyntaxKind.SlashToken) {
isStartingCloseTag = true;
location = contextToken;
}
break;
case SyntaxKind.BinaryExpression:
if (!((contextToken.parent as BinaryExpression).left.flags & NodeFlags.ThisNodeHasError)) {
if (!((parent as BinaryExpression).left.flags & NodeFlags.ThisNodeHasError)) {
// It has a left-hand side, so we're not in an opening JSX tag.
break;
}
@@ -482,7 +490,7 @@ namespace ts.Completions {
case SyntaxKind.JsxSelfClosingElement:
case SyntaxKind.JsxElement:
case SyntaxKind.JsxOpeningElement:
if (kind === SyntaxKind.LessThanToken) {
if (contextToken.kind === SyntaxKind.LessThanToken) {
isRightOfOpenTag = true;
location = contextToken;
}
@@ -950,6 +958,7 @@ namespace ts.Completions {
case SyntaxKind.LessThanSlashToken:
case SyntaxKind.SlashToken:
case SyntaxKind.Identifier:
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.JsxAttributes:
case SyntaxKind.JsxAttribute:
case SyntaxKind.JsxSpreadAttribute:
+2 -1
View File
@@ -178,7 +178,8 @@ namespace ts.JsDoc {
const posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position);
const lineStart = sourceFile.getLineStarts()[posLineAndChar.line];
const indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character);
// replace non-whitespace characters in prefix with spaces.
const indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character).replace(/\S/i, () => " ");
const isJavaScriptFile = hasJavaScriptFileExtension(sourceFile.fileName);
let docParams = "";
@@ -0,0 +1,86 @@
//// [indexedAccessTypeConstraints.ts]
// Repro from #14557
interface IData<T> {
content: T;
}
type Data<T> = {
get: <K extends keyof T>(prop: K) => T[K];
};
class Parent<M> {
private data: Data<M>;
getData(): Data<M> {
return this.data;
}
}
export class Foo<C> extends Parent<IData<C>> {
getContent(): C {
return this.getData().get('content');
}
}
export class Bar<C, T extends IData<C>> extends Parent<T> {
getContent(): C {
return this.getData().get('content');
}
}
// Repro from #14557
function foo<C, T extends { content: C }>(x: C, y: T['content']) {
x = y;
}
//// [indexedAccessTypeConstraints.js]
// Repro from #14557
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var Parent = (function () {
function Parent() {
}
Parent.prototype.getData = function () {
return this.data;
};
return Parent;
}());
var Foo = (function (_super) {
__extends(Foo, _super);
function Foo() {
return _super !== null && _super.apply(this, arguments) || this;
}
Foo.prototype.getContent = function () {
return this.getData().get('content');
};
return Foo;
}(Parent));
exports.Foo = Foo;
var Bar = (function (_super) {
__extends(Bar, _super);
function Bar() {
return _super !== null && _super.apply(this, arguments) || this;
}
Bar.prototype.getContent = function () {
return this.getData().get('content');
};
return Bar;
}(Parent));
exports.Bar = Bar;
// Repro from #14557
function foo(x, y) {
x = y;
}
@@ -0,0 +1,109 @@
=== tests/cases/compiler/indexedAccessTypeConstraints.ts ===
// Repro from #14557
interface IData<T> {
>IData : Symbol(IData, Decl(indexedAccessTypeConstraints.ts, 0, 0))
>T : Symbol(T, Decl(indexedAccessTypeConstraints.ts, 3, 16))
content: T;
>content : Symbol(IData.content, Decl(indexedAccessTypeConstraints.ts, 3, 20))
>T : Symbol(T, Decl(indexedAccessTypeConstraints.ts, 3, 16))
}
type Data<T> = {
>Data : Symbol(Data, Decl(indexedAccessTypeConstraints.ts, 5, 1))
>T : Symbol(T, Decl(indexedAccessTypeConstraints.ts, 7, 10))
get: <K extends keyof T>(prop: K) => T[K];
>get : Symbol(get, Decl(indexedAccessTypeConstraints.ts, 7, 16))
>K : Symbol(K, Decl(indexedAccessTypeConstraints.ts, 8, 10))
>T : Symbol(T, Decl(indexedAccessTypeConstraints.ts, 7, 10))
>prop : Symbol(prop, Decl(indexedAccessTypeConstraints.ts, 8, 29))
>K : Symbol(K, Decl(indexedAccessTypeConstraints.ts, 8, 10))
>T : Symbol(T, Decl(indexedAccessTypeConstraints.ts, 7, 10))
>K : Symbol(K, Decl(indexedAccessTypeConstraints.ts, 8, 10))
};
class Parent<M> {
>Parent : Symbol(Parent, Decl(indexedAccessTypeConstraints.ts, 9, 2))
>M : Symbol(M, Decl(indexedAccessTypeConstraints.ts, 11, 13))
private data: Data<M>;
>data : Symbol(Parent.data, Decl(indexedAccessTypeConstraints.ts, 11, 17))
>Data : Symbol(Data, Decl(indexedAccessTypeConstraints.ts, 5, 1))
>M : Symbol(M, Decl(indexedAccessTypeConstraints.ts, 11, 13))
getData(): Data<M> {
>getData : Symbol(Parent.getData, Decl(indexedAccessTypeConstraints.ts, 12, 26))
>Data : Symbol(Data, Decl(indexedAccessTypeConstraints.ts, 5, 1))
>M : Symbol(M, Decl(indexedAccessTypeConstraints.ts, 11, 13))
return this.data;
>this.data : Symbol(Parent.data, Decl(indexedAccessTypeConstraints.ts, 11, 17))
>this : Symbol(Parent, Decl(indexedAccessTypeConstraints.ts, 9, 2))
>data : Symbol(Parent.data, Decl(indexedAccessTypeConstraints.ts, 11, 17))
}
}
export class Foo<C> extends Parent<IData<C>> {
>Foo : Symbol(Foo, Decl(indexedAccessTypeConstraints.ts, 16, 1))
>C : Symbol(C, Decl(indexedAccessTypeConstraints.ts, 18, 17))
>Parent : Symbol(Parent, Decl(indexedAccessTypeConstraints.ts, 9, 2))
>IData : Symbol(IData, Decl(indexedAccessTypeConstraints.ts, 0, 0))
>C : Symbol(C, Decl(indexedAccessTypeConstraints.ts, 18, 17))
getContent(): C {
>getContent : Symbol(Foo.getContent, Decl(indexedAccessTypeConstraints.ts, 18, 46))
>C : Symbol(C, Decl(indexedAccessTypeConstraints.ts, 18, 17))
return this.getData().get('content');
>this.getData().get : Symbol(get, Decl(indexedAccessTypeConstraints.ts, 7, 16))
>this.getData : Symbol(Parent.getData, Decl(indexedAccessTypeConstraints.ts, 12, 26))
>this : Symbol(Foo, Decl(indexedAccessTypeConstraints.ts, 16, 1))
>getData : Symbol(Parent.getData, Decl(indexedAccessTypeConstraints.ts, 12, 26))
>get : Symbol(get, Decl(indexedAccessTypeConstraints.ts, 7, 16))
}
}
export class Bar<C, T extends IData<C>> extends Parent<T> {
>Bar : Symbol(Bar, Decl(indexedAccessTypeConstraints.ts, 22, 1))
>C : Symbol(C, Decl(indexedAccessTypeConstraints.ts, 24, 17))
>T : Symbol(T, Decl(indexedAccessTypeConstraints.ts, 24, 19))
>IData : Symbol(IData, Decl(indexedAccessTypeConstraints.ts, 0, 0))
>C : Symbol(C, Decl(indexedAccessTypeConstraints.ts, 24, 17))
>Parent : Symbol(Parent, Decl(indexedAccessTypeConstraints.ts, 9, 2))
>T : Symbol(T, Decl(indexedAccessTypeConstraints.ts, 24, 19))
getContent(): C {
>getContent : Symbol(Bar.getContent, Decl(indexedAccessTypeConstraints.ts, 24, 59))
>C : Symbol(C, Decl(indexedAccessTypeConstraints.ts, 24, 17))
return this.getData().get('content');
>this.getData().get : Symbol(get, Decl(indexedAccessTypeConstraints.ts, 7, 16))
>this.getData : Symbol(Parent.getData, Decl(indexedAccessTypeConstraints.ts, 12, 26))
>this : Symbol(Bar, Decl(indexedAccessTypeConstraints.ts, 22, 1))
>getData : Symbol(Parent.getData, Decl(indexedAccessTypeConstraints.ts, 12, 26))
>get : Symbol(get, Decl(indexedAccessTypeConstraints.ts, 7, 16))
}
}
// Repro from #14557
function foo<C, T extends { content: C }>(x: C, y: T['content']) {
>foo : Symbol(foo, Decl(indexedAccessTypeConstraints.ts, 28, 1))
>C : Symbol(C, Decl(indexedAccessTypeConstraints.ts, 32, 13))
>T : Symbol(T, Decl(indexedAccessTypeConstraints.ts, 32, 15))
>content : Symbol(content, Decl(indexedAccessTypeConstraints.ts, 32, 27))
>C : Symbol(C, Decl(indexedAccessTypeConstraints.ts, 32, 13))
>x : Symbol(x, Decl(indexedAccessTypeConstraints.ts, 32, 42))
>C : Symbol(C, Decl(indexedAccessTypeConstraints.ts, 32, 13))
>y : Symbol(y, Decl(indexedAccessTypeConstraints.ts, 32, 47))
>T : Symbol(T, Decl(indexedAccessTypeConstraints.ts, 32, 15))
x = y;
>x : Symbol(x, Decl(indexedAccessTypeConstraints.ts, 32, 42))
>y : Symbol(y, Decl(indexedAccessTypeConstraints.ts, 32, 47))
}
@@ -0,0 +1,116 @@
=== tests/cases/compiler/indexedAccessTypeConstraints.ts ===
// Repro from #14557
interface IData<T> {
>IData : IData<T>
>T : T
content: T;
>content : T
>T : T
}
type Data<T> = {
>Data : { get: <K extends keyof T>(prop: K) => T[K]; }
>T : T
get: <K extends keyof T>(prop: K) => T[K];
>get : <K extends keyof T>(prop: K) => T[K]
>K : K
>T : T
>prop : K
>K : K
>T : T
>K : K
};
class Parent<M> {
>Parent : Parent<M>
>M : M
private data: Data<M>;
>data : { get: <K extends keyof M>(prop: K) => M[K]; }
>Data : { get: <K extends keyof T>(prop: K) => T[K]; }
>M : M
getData(): Data<M> {
>getData : () => { get: <K extends keyof M>(prop: K) => M[K]; }
>Data : { get: <K extends keyof T>(prop: K) => T[K]; }
>M : M
return this.data;
>this.data : { get: <K extends keyof M>(prop: K) => M[K]; }
>this : this
>data : { get: <K extends keyof M>(prop: K) => M[K]; }
}
}
export class Foo<C> extends Parent<IData<C>> {
>Foo : Foo<C>
>C : C
>Parent : Parent<IData<C>>
>IData : IData<T>
>C : C
getContent(): C {
>getContent : () => C
>C : C
return this.getData().get('content');
>this.getData().get('content') : C
>this.getData().get : <K extends "content">(prop: K) => IData<C>[K]
>this.getData() : { get: <K extends "content">(prop: K) => IData<C>[K]; }
>this.getData : () => { get: <K extends "content">(prop: K) => IData<C>[K]; }
>this : this
>getData : () => { get: <K extends "content">(prop: K) => IData<C>[K]; }
>get : <K extends "content">(prop: K) => IData<C>[K]
>'content' : "content"
}
}
export class Bar<C, T extends IData<C>> extends Parent<T> {
>Bar : Bar<C, T>
>C : C
>T : T
>IData : IData<T>
>C : C
>Parent : Parent<T>
>T : T
getContent(): C {
>getContent : () => C
>C : C
return this.getData().get('content');
>this.getData().get('content') : T["content"]
>this.getData().get : <K extends keyof T>(prop: K) => T[K]
>this.getData() : { get: <K extends keyof T>(prop: K) => T[K]; }
>this.getData : () => { get: <K extends keyof T>(prop: K) => T[K]; }
>this : this
>getData : () => { get: <K extends keyof T>(prop: K) => T[K]; }
>get : <K extends keyof T>(prop: K) => T[K]
>'content' : "content"
}
}
// Repro from #14557
function foo<C, T extends { content: C }>(x: C, y: T['content']) {
>foo : <C, T extends { content: C; }>(x: C, y: T["content"]) => void
>C : C
>T : T
>content : C
>C : C
>x : C
>C : C
>y : T["content"]
>T : T
x = y;
>x = y : T["content"]
>x : C
>y : T["content"]
}
@@ -0,0 +1,282 @@
=== tests/cases/conformance/salsa/a.ts ===
var a: any;
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var t: [any, any];
>t : Symbol(t, Decl(a.ts, 2, 3), Decl(a.js, 2, 3), Decl(a.js, 11, 3), Decl(a.js, 12, 3), Decl(a.js, 13, 3))
declare function f1<T>(t: T): T
>f1 : Symbol(f1, Decl(a.ts, 2, 18))
>T : Symbol(T, Decl(a.ts, 3, 20))
>t : Symbol(t, Decl(a.ts, 3, 23))
>T : Symbol(T, Decl(a.ts, 3, 20))
>T : Symbol(T, Decl(a.ts, 3, 20))
declare function f2<T>(t: T[]): T;
>f2 : Symbol(f2, Decl(a.ts, 3, 31))
>T : Symbol(T, Decl(a.ts, 4, 20))
>t : Symbol(t, Decl(a.ts, 4, 23))
>T : Symbol(T, Decl(a.ts, 4, 20))
>T : Symbol(T, Decl(a.ts, 4, 20))
declare function f3<T, U>(t: [T, U]): [T, U];
>f3 : Symbol(f3, Decl(a.ts, 4, 34))
>T : Symbol(T, Decl(a.ts, 5, 20))
>U : Symbol(U, Decl(a.ts, 5, 22))
>t : Symbol(t, Decl(a.ts, 5, 26))
>T : Symbol(T, Decl(a.ts, 5, 20))
>U : Symbol(U, Decl(a.ts, 5, 22))
>T : Symbol(T, Decl(a.ts, 5, 20))
>U : Symbol(U, Decl(a.ts, 5, 22))
declare function f4<T>(x: { bar: T; baz: T }): T;
>f4 : Symbol(f4, Decl(a.ts, 5, 45))
>T : Symbol(T, Decl(a.ts, 6, 20))
>x : Symbol(x, Decl(a.ts, 6, 23))
>bar : Symbol(bar, Decl(a.ts, 6, 27))
>T : Symbol(T, Decl(a.ts, 6, 20))
>baz : Symbol(baz, Decl(a.ts, 6, 35))
>T : Symbol(T, Decl(a.ts, 6, 20))
>T : Symbol(T, Decl(a.ts, 6, 20))
declare function f5<T>(x: (a: T) => void): T;
>f5 : Symbol(f5, Decl(a.ts, 6, 49))
>T : Symbol(T, Decl(a.ts, 7, 20))
>x : Symbol(x, Decl(a.ts, 7, 23))
>a : Symbol(a, Decl(a.ts, 7, 27))
>T : Symbol(T, Decl(a.ts, 7, 20))
>T : Symbol(T, Decl(a.ts, 7, 20))
declare function f6<T>(x: new (a: T) => {}): T;
>f6 : Symbol(f6, Decl(a.ts, 7, 45))
>T : Symbol(T, Decl(a.ts, 8, 20))
>x : Symbol(x, Decl(a.ts, 8, 23))
>a : Symbol(a, Decl(a.ts, 8, 31))
>T : Symbol(T, Decl(a.ts, 8, 20))
>T : Symbol(T, Decl(a.ts, 8, 20))
declare function f7<T>(x: (a: any) => a is T): T;
>f7 : Symbol(f7, Decl(a.ts, 8, 47))
>T : Symbol(T, Decl(a.ts, 9, 20))
>x : Symbol(x, Decl(a.ts, 9, 23))
>a : Symbol(a, Decl(a.ts, 9, 27))
>a : Symbol(a, Decl(a.ts, 9, 27))
>T : Symbol(T, Decl(a.ts, 9, 20))
>T : Symbol(T, Decl(a.ts, 9, 20))
declare function f8<T>(x: () => T): T;
>f8 : Symbol(f8, Decl(a.ts, 9, 49))
>T : Symbol(T, Decl(a.ts, 10, 20))
>x : Symbol(x, Decl(a.ts, 10, 23))
>T : Symbol(T, Decl(a.ts, 10, 20))
>T : Symbol(T, Decl(a.ts, 10, 20))
declare function f9<T>(x: new () => T): T;
>f9 : Symbol(f9, Decl(a.ts, 10, 38))
>T : Symbol(T, Decl(a.ts, 11, 20))
>x : Symbol(x, Decl(a.ts, 11, 23))
>T : Symbol(T, Decl(a.ts, 11, 20))
>T : Symbol(T, Decl(a.ts, 11, 20))
declare function f10<T>(x: { [x: string]: T }): T;
>f10 : Symbol(f10, Decl(a.ts, 11, 42))
>T : Symbol(T, Decl(a.ts, 12, 21))
>x : Symbol(x, Decl(a.ts, 12, 24))
>x : Symbol(x, Decl(a.ts, 12, 30))
>T : Symbol(T, Decl(a.ts, 12, 21))
>T : Symbol(T, Decl(a.ts, 12, 21))
declare function f11<T>(x: { [x: number]: T }): T;
>f11 : Symbol(f11, Decl(a.ts, 12, 50))
>T : Symbol(T, Decl(a.ts, 13, 21))
>x : Symbol(x, Decl(a.ts, 13, 24))
>x : Symbol(x, Decl(a.ts, 13, 30))
>T : Symbol(T, Decl(a.ts, 13, 21))
>T : Symbol(T, Decl(a.ts, 13, 21))
declare function f12<T, U>(x: T | U): [T, U];
>f12 : Symbol(f12, Decl(a.ts, 13, 50))
>T : Symbol(T, Decl(a.ts, 14, 21))
>U : Symbol(U, Decl(a.ts, 14, 23))
>x : Symbol(x, Decl(a.ts, 14, 27))
>T : Symbol(T, Decl(a.ts, 14, 21))
>U : Symbol(U, Decl(a.ts, 14, 23))
>T : Symbol(T, Decl(a.ts, 14, 21))
>U : Symbol(U, Decl(a.ts, 14, 23))
declare function f13<T, U>(x: T & U): [T, U];
>f13 : Symbol(f13, Decl(a.ts, 14, 45))
>T : Symbol(T, Decl(a.ts, 15, 21))
>U : Symbol(U, Decl(a.ts, 15, 23))
>x : Symbol(x, Decl(a.ts, 15, 27))
>T : Symbol(T, Decl(a.ts, 15, 21))
>U : Symbol(U, Decl(a.ts, 15, 23))
>T : Symbol(T, Decl(a.ts, 15, 21))
>U : Symbol(U, Decl(a.ts, 15, 23))
declare function f14<T, U>(x: { a: T | U, b: U & T }): [T, U];
>f14 : Symbol(f14, Decl(a.ts, 15, 45))
>T : Symbol(T, Decl(a.ts, 16, 21))
>U : Symbol(U, Decl(a.ts, 16, 23))
>x : Symbol(x, Decl(a.ts, 16, 27))
>a : Symbol(a, Decl(a.ts, 16, 31))
>T : Symbol(T, Decl(a.ts, 16, 21))
>U : Symbol(U, Decl(a.ts, 16, 23))
>b : Symbol(b, Decl(a.ts, 16, 41))
>U : Symbol(U, Decl(a.ts, 16, 23))
>T : Symbol(T, Decl(a.ts, 16, 21))
>T : Symbol(T, Decl(a.ts, 16, 21))
>U : Symbol(U, Decl(a.ts, 16, 23))
interface I<T> { }
>I : Symbol(I, Decl(a.ts, 16, 62))
>T : Symbol(T, Decl(a.ts, 17, 12))
declare function f15<T>(x: I<T>): T;
>f15 : Symbol(f15, Decl(a.ts, 17, 18))
>T : Symbol(T, Decl(a.ts, 18, 21))
>x : Symbol(x, Decl(a.ts, 18, 24))
>I : Symbol(I, Decl(a.ts, 16, 62))
>T : Symbol(T, Decl(a.ts, 18, 21))
>T : Symbol(T, Decl(a.ts, 18, 21))
declare function f16<T>(x: Partial<T>): T;
>f16 : Symbol(f16, Decl(a.ts, 18, 36))
>T : Symbol(T, Decl(a.ts, 19, 21))
>x : Symbol(x, Decl(a.ts, 19, 24))
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
>T : Symbol(T, Decl(a.ts, 19, 21))
>T : Symbol(T, Decl(a.ts, 19, 21))
declare function f17<T, K>(x: {[P in keyof T]: K}): T;
>f17 : Symbol(f17, Decl(a.ts, 19, 42))
>T : Symbol(T, Decl(a.ts, 20, 21))
>K : Symbol(K, Decl(a.ts, 20, 23))
>x : Symbol(x, Decl(a.ts, 20, 27))
>P : Symbol(P, Decl(a.ts, 20, 32))
>T : Symbol(T, Decl(a.ts, 20, 21))
>K : Symbol(K, Decl(a.ts, 20, 23))
>T : Symbol(T, Decl(a.ts, 20, 21))
declare function f18<T, K extends keyof T>(x: {[P in K]: T[P]}): T;
>f18 : Symbol(f18, Decl(a.ts, 20, 54))
>T : Symbol(T, Decl(a.ts, 21, 21))
>K : Symbol(K, Decl(a.ts, 21, 23))
>T : Symbol(T, Decl(a.ts, 21, 21))
>x : Symbol(x, Decl(a.ts, 21, 43))
>P : Symbol(P, Decl(a.ts, 21, 48))
>K : Symbol(K, Decl(a.ts, 21, 23))
>T : Symbol(T, Decl(a.ts, 21, 21))
>P : Symbol(P, Decl(a.ts, 21, 48))
>T : Symbol(T, Decl(a.ts, 21, 21))
declare function f19<T, K extends keyof T>(k: K, x: T[K]): T;
>f19 : Symbol(f19, Decl(a.ts, 21, 67))
>T : Symbol(T, Decl(a.ts, 22, 21))
>K : Symbol(K, Decl(a.ts, 22, 23))
>T : Symbol(T, Decl(a.ts, 22, 21))
>k : Symbol(k, Decl(a.ts, 22, 43))
>K : Symbol(K, Decl(a.ts, 22, 23))
>x : Symbol(x, Decl(a.ts, 22, 48))
>T : Symbol(T, Decl(a.ts, 22, 21))
>K : Symbol(K, Decl(a.ts, 22, 23))
>T : Symbol(T, Decl(a.ts, 22, 21))
=== tests/cases/conformance/salsa/a.js ===
var a = f1(a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f1 : Symbol(f1, Decl(a.ts, 2, 18))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var a = f2(a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f2 : Symbol(f2, Decl(a.ts, 3, 31))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var t = f3(a);
>t : Symbol(t, Decl(a.ts, 2, 3), Decl(a.js, 2, 3), Decl(a.js, 11, 3), Decl(a.js, 12, 3), Decl(a.js, 13, 3))
>f3 : Symbol(f3, Decl(a.ts, 4, 34))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var a = f4(a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f4 : Symbol(f4, Decl(a.ts, 5, 45))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var a = f5(a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f5 : Symbol(f5, Decl(a.ts, 6, 49))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var a = f6(a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f6 : Symbol(f6, Decl(a.ts, 7, 45))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var a = f7(a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f7 : Symbol(f7, Decl(a.ts, 8, 47))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var a = f8(a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f8 : Symbol(f8, Decl(a.ts, 9, 49))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var a = f9(a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f9 : Symbol(f9, Decl(a.ts, 10, 38))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var a = f10(a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f10 : Symbol(f10, Decl(a.ts, 11, 42))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var a = f11(a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f11 : Symbol(f11, Decl(a.ts, 12, 50))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var t = f12(a);
>t : Symbol(t, Decl(a.ts, 2, 3), Decl(a.js, 2, 3), Decl(a.js, 11, 3), Decl(a.js, 12, 3), Decl(a.js, 13, 3))
>f12 : Symbol(f12, Decl(a.ts, 13, 50))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var t = f13(a);
>t : Symbol(t, Decl(a.ts, 2, 3), Decl(a.js, 2, 3), Decl(a.js, 11, 3), Decl(a.js, 12, 3), Decl(a.js, 13, 3))
>f13 : Symbol(f13, Decl(a.ts, 14, 45))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var t = f14(a);
>t : Symbol(t, Decl(a.ts, 2, 3), Decl(a.js, 2, 3), Decl(a.js, 11, 3), Decl(a.js, 12, 3), Decl(a.js, 13, 3))
>f14 : Symbol(f14, Decl(a.ts, 15, 45))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var a = f15(a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f15 : Symbol(f15, Decl(a.ts, 17, 18))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var a = f16(a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f16 : Symbol(f16, Decl(a.ts, 18, 36))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var a = f17(a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f17 : Symbol(f17, Decl(a.ts, 19, 42))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var a = f18(a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f18 : Symbol(f18, Decl(a.ts, 20, 54))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
var a = f19(a, a);
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>f19 : Symbol(f19, Decl(a.ts, 21, 67))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
>a : Symbol(a, Decl(a.ts, 1, 3), Decl(a.js, 0, 3), Decl(a.js, 1, 3), Decl(a.js, 3, 3), Decl(a.js, 4, 3), Decl(a.js, 5, 3), Decl(a.js, 6, 3), Decl(a.js, 7, 3), Decl(a.js, 8, 3), Decl(a.js, 9, 3), Decl(a.js, 10, 3), Decl(a.js, 14, 3), Decl(a.js, 15, 3), Decl(a.js, 16, 3), Decl(a.js, 17, 3), Decl(a.js, 18, 3))
@@ -0,0 +1,301 @@
=== tests/cases/conformance/salsa/a.ts ===
var a: any;
>a : any
var t: [any, any];
>t : [any, any]
declare function f1<T>(t: T): T
>f1 : <T>(t: T) => T
>T : T
>t : T
>T : T
>T : T
declare function f2<T>(t: T[]): T;
>f2 : <T>(t: T[]) => T
>T : T
>t : T[]
>T : T
>T : T
declare function f3<T, U>(t: [T, U]): [T, U];
>f3 : <T, U>(t: [T, U]) => [T, U]
>T : T
>U : U
>t : [T, U]
>T : T
>U : U
>T : T
>U : U
declare function f4<T>(x: { bar: T; baz: T }): T;
>f4 : <T>(x: { bar: T; baz: T; }) => T
>T : T
>x : { bar: T; baz: T; }
>bar : T
>T : T
>baz : T
>T : T
>T : T
declare function f5<T>(x: (a: T) => void): T;
>f5 : <T>(x: (a: T) => void) => T
>T : T
>x : (a: T) => void
>a : T
>T : T
>T : T
declare function f6<T>(x: new (a: T) => {}): T;
>f6 : <T>(x: new (a: T) => {}) => T
>T : T
>x : new (a: T) => {}
>a : T
>T : T
>T : T
declare function f7<T>(x: (a: any) => a is T): T;
>f7 : <T>(x: (a: any) => a is T) => T
>T : T
>x : (a: any) => a is T
>a : any
>a : any
>T : T
>T : T
declare function f8<T>(x: () => T): T;
>f8 : <T>(x: () => T) => T
>T : T
>x : () => T
>T : T
>T : T
declare function f9<T>(x: new () => T): T;
>f9 : <T>(x: new () => T) => T
>T : T
>x : new () => T
>T : T
>T : T
declare function f10<T>(x: { [x: string]: T }): T;
>f10 : <T>(x: { [x: string]: T; }) => T
>T : T
>x : { [x: string]: T; }
>x : string
>T : T
>T : T
declare function f11<T>(x: { [x: number]: T }): T;
>f11 : <T>(x: { [x: number]: T; }) => T
>T : T
>x : { [x: number]: T; }
>x : number
>T : T
>T : T
declare function f12<T, U>(x: T | U): [T, U];
>f12 : <T, U>(x: T | U) => [T, U]
>T : T
>U : U
>x : T | U
>T : T
>U : U
>T : T
>U : U
declare function f13<T, U>(x: T & U): [T, U];
>f13 : <T, U>(x: T & U) => [T, U]
>T : T
>U : U
>x : T & U
>T : T
>U : U
>T : T
>U : U
declare function f14<T, U>(x: { a: T | U, b: U & T }): [T, U];
>f14 : <T, U>(x: { a: T | U; b: U & T; }) => [T, U]
>T : T
>U : U
>x : { a: T | U; b: U & T; }
>a : T | U
>T : T
>U : U
>b : U & T
>U : U
>T : T
>T : T
>U : U
interface I<T> { }
>I : I<T>
>T : T
declare function f15<T>(x: I<T>): T;
>f15 : <T>(x: I<T>) => T
>T : T
>x : I<T>
>I : I<T>
>T : T
>T : T
declare function f16<T>(x: Partial<T>): T;
>f16 : <T>(x: Partial<T>) => T
>T : T
>x : Partial<T>
>Partial : Partial<T>
>T : T
>T : T
declare function f17<T, K>(x: {[P in keyof T]: K}): T;
>f17 : <T, K>(x: { [P in keyof T]: K; }) => T
>T : T
>K : K
>x : { [P in keyof T]: K; }
>P : P
>T : T
>K : K
>T : T
declare function f18<T, K extends keyof T>(x: {[P in K]: T[P]}): T;
>f18 : <T, K extends keyof T>(x: { [P in K]: T[P]; }) => T
>T : T
>K : K
>T : T
>x : { [P in K]: T[P]; }
>P : P
>K : K
>T : T
>P : P
>T : T
declare function f19<T, K extends keyof T>(k: K, x: T[K]): T;
>f19 : <T, K extends keyof T>(k: K, x: T[K]) => T
>T : T
>K : K
>T : T
>k : K
>K : K
>x : T[K]
>T : T
>K : K
>T : T
=== tests/cases/conformance/salsa/a.js ===
var a = f1(a);
>a : any
>f1(a) : any
>f1 : <T>(t: T) => T
>a : any
var a = f2(a);
>a : any
>f2(a) : any
>f2 : <T>(t: T[]) => T
>a : any
var t = f3(a);
>t : [any, any]
>f3(a) : [any, any]
>f3 : <T, U>(t: [T, U]) => [T, U]
>a : any
var a = f4(a);
>a : any
>f4(a) : any
>f4 : <T>(x: { bar: T; baz: T; }) => T
>a : any
var a = f5(a);
>a : any
>f5(a) : any
>f5 : <T>(x: (a: T) => void) => T
>a : any
var a = f6(a);
>a : any
>f6(a) : any
>f6 : <T>(x: new (a: T) => {}) => T
>a : any
var a = f7(a);
>a : any
>f7(a) : any
>f7 : <T>(x: (a: any) => a is T) => T
>a : any
var a = f8(a);
>a : any
>f8(a) : any
>f8 : <T>(x: () => T) => T
>a : any
var a = f9(a);
>a : any
>f9(a) : any
>f9 : <T>(x: new () => T) => T
>a : any
var a = f10(a);
>a : any
>f10(a) : any
>f10 : <T>(x: { [x: string]: T; }) => T
>a : any
var a = f11(a);
>a : any
>f11(a) : any
>f11 : <T>(x: { [x: number]: T; }) => T
>a : any
var t = f12(a);
>t : [any, any]
>f12(a) : [any, any]
>f12 : <T, U>(x: T | U) => [T, U]
>a : any
var t = f13(a);
>t : [any, any]
>f13(a) : [any, any]
>f13 : <T, U>(x: T & U) => [T, U]
>a : any
var t = f14(a);
>t : [any, any]
>f14(a) : [any, any]
>f14 : <T, U>(x: { a: T | U; b: U & T; }) => [T, U]
>a : any
var a = f15(a);
>a : any
>f15(a) : any
>f15 : <T>(x: I<T>) => T
>a : any
var a = f16(a);
>a : any
>f16(a) : any
>f16 : <T>(x: Partial<T>) => T
>a : any
var a = f17(a);
>a : any
>f17(a) : any
>f17 : <T, K>(x: { [P in keyof T]: K; }) => T
>a : any
var a = f18(a);
>a : any
>f18(a) : any
>f18 : <T, K extends keyof T>(x: { [P in K]: T[P]; }) => T
>a : any
var a = f19(a, a);
>a : any
>f19(a, a) : any
>f19 : <T, K extends keyof T>(k: K, x: T[K]) => T
>a : any
>a : any
@@ -1,14 +1,18 @@
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(12,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
Type 'T' is not assignable to type 'U'.
Type 'T[string]' is not assignable to type 'U[keyof T]'.
Type 'T' is not assignable to type 'U'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(17,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
Type 'T' is not assignable to type 'U'.
Type 'T[string]' is not assignable to type 'U[K]'.
Type 'T' is not assignable to type 'U'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(21,5): error TS2536: Type 'keyof U' cannot be used to index type 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(22,5): error TS2322: Type 'T[keyof U]' is not assignable to type 'U[keyof U]'.
Type 'T' is not assignable to type 'U'.
Type 'T[string]' is not assignable to type 'U[keyof U]'.
Type 'T' is not assignable to type 'U'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(22,12): error TS2536: Type 'keyof U' cannot be used to index type 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(26,5): error TS2536: Type 'K' cannot be used to index type 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(27,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
Type 'T' is not assignable to type 'U'.
Type 'T[string]' is not assignable to type 'U[K]'.
Type 'T' is not assignable to type 'U'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(27,12): error TS2536: Type 'K' cannot be used to index type 'T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(31,5): error TS2322: Type 'T[keyof T] | undefined' is not assignable to type 'T[keyof T]'.
Type 'undefined' is not assignable to type 'T[keyof T]'.
@@ -17,13 +21,19 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(36,5): error TS2
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(41,5): error TS2322: Type 'U[keyof T] | undefined' is not assignable to type 'T[keyof T]'.
Type 'undefined' is not assignable to type 'T[keyof T]'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(42,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T] | undefined'.
Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
Type 'T' is not assignable to type 'U'.
Type 'T[string]' is not assignable to type 'U[keyof T] | undefined'.
Type 'T[string]' is not assignable to type 'U[keyof T]'.
Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
Type 'T[string]' is not assignable to type 'U[keyof T]'.
Type 'T' is not assignable to type 'U'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(46,5): error TS2322: Type 'U[K] | undefined' is not assignable to type 'T[K]'.
Type 'undefined' is not assignable to type 'T[K]'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(47,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K] | undefined'.
Type 'T[K]' is not assignable to type 'U[K]'.
Type 'T' is not assignable to type 'U'.
Type 'T[string]' is not assignable to type 'U[K] | undefined'.
Type 'T[string]' is not assignable to type 'U[K]'.
Type 'T[K]' is not assignable to type 'U[K]'.
Type 'T[string]' is not assignable to type 'U[K]'.
Type 'T' is not assignable to type 'U'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(52,5): error TS2542: Index signature in type 'Readonly<T>' only permits reading.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(57,5): error TS2542: Index signature in type 'Readonly<T>' only permits reading.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(62,5): error TS2542: Index signature in type 'Readonly<U>' only permits reading.
@@ -33,7 +43,8 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(76,5): error TS2
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(126,5): error TS2322: Type 'Partial<U>' is not assignable to type 'Identity<U>'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(142,5): error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'.
Type 'T[P]' is not assignable to type 'U[P]'.
Type 'T' is not assignable to type 'U'.
Type 'T[string]' is not assignable to type 'U[P]'.
Type 'T' is not assignable to type 'U'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(147,5): error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof U]: U[P]; }'.
Type 'keyof U' is not assignable to type 'keyof T'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(152,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in keyof T]: T[P]; }'.
@@ -44,7 +55,8 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(162,5): error TS
Type 'keyof T' is not assignable to type 'K'.
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(167,5): error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in K]: U[P]; }'.
Type 'T[P]' is not assignable to type 'U[P]'.
Type 'T' is not assignable to type 'U'.
Type 'T[string]' is not assignable to type 'U[P]'.
Type 'T' is not assignable to type 'U'.
==== tests/cases/conformance/types/mapped/mappedTypeRelationships.ts (27 errors) ====
@@ -62,7 +74,8 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(167,5): error TS
y[k] = x[k]; // Error
~~~~
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[keyof T]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
}
function f4<T, U extends T, K extends keyof T>(x: T, y: U, k: K) {
@@ -70,7 +83,8 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(167,5): error TS
y[k] = x[k]; // Error
~~~~
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[K]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
}
function f5<T, U extends T>(x: T, y: U, k: keyof U) {
@@ -80,7 +94,8 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(167,5): error TS
y[k] = x[k]; // Error
~~~~
!!! error TS2322: Type 'T[keyof U]' is not assignable to type 'U[keyof U]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[keyof U]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
~~~~
!!! error TS2536: Type 'keyof U' cannot be used to index type 'T'.
}
@@ -92,7 +107,8 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(167,5): error TS
y[k] = x[k]; // Error
~~~~
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[K]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
~~~~
!!! error TS2536: Type 'K' cannot be used to index type 'T'.
}
@@ -121,8 +137,11 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(167,5): error TS
y[k] = x[k]; // Error
~~~~
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T] | undefined'.
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[keyof T] | undefined'.
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[keyof T]'.
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[keyof T]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
}
function f13<T, U extends T, K extends keyof T>(x: T, y: Partial<U>, k: K) {
@@ -133,8 +152,11 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(167,5): error TS
y[k] = x[k]; // Error
~~~~
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K] | undefined'.
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[K] | undefined'.
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[K]'.
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[K]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
}
function f20<T>(x: T, y: Readonly<T>, k: keyof T) {
@@ -247,7 +269,8 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(167,5): error TS
~
!!! error TS2322: Type '{ [P in keyof T]: T[P]; }' is not assignable to type '{ [P in keyof T]: U[P]; }'.
!!! error TS2322: Type 'T[P]' is not assignable to type 'U[P]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[P]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
}
function f72<T, U extends T>(x: { [P in keyof T]: T[P] }, y: { [P in keyof U]: U[P] }) {
@@ -288,6 +311,7 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(167,5): error TS
~
!!! error TS2322: Type '{ [P in K]: T[P]; }' is not assignable to type '{ [P in K]: U[P]; }'.
!!! error TS2322: Type 'T[P]' is not assignable to type 'U[P]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[P]'.
!!! error TS2322: Type 'T' is not assignable to type 'U'.
}
@@ -0,0 +1,36 @@
// @strict: true
// Repro from #14557
interface IData<T> {
content: T;
}
type Data<T> = {
get: <K extends keyof T>(prop: K) => T[K];
};
class Parent<M> {
private data: Data<M>;
getData(): Data<M> {
return this.data;
}
}
export class Foo<C> extends Parent<IData<C>> {
getContent(): C {
return this.getData().get('content');
}
}
export class Bar<C, T extends IData<C>> extends Parent<T> {
getContent(): C {
return this.getData().get('content');
}
}
// Repro from #14557
function foo<C, T extends { content: C }>(x: C, y: T['content']) {
x = y;
}
@@ -0,0 +1,47 @@
// @allowJs: true
// @noEmit: true
// @fileName: a.ts
var a: any;
var t: [any, any];
declare function f1<T>(t: T): T
declare function f2<T>(t: T[]): T;
declare function f3<T, U>(t: [T, U]): [T, U];
declare function f4<T>(x: { bar: T; baz: T }): T;
declare function f5<T>(x: (a: T) => void): T;
declare function f6<T>(x: new (a: T) => {}): T;
declare function f7<T>(x: (a: any) => a is T): T;
declare function f8<T>(x: () => T): T;
declare function f9<T>(x: new () => T): T;
declare function f10<T>(x: { [x: string]: T }): T;
declare function f11<T>(x: { [x: number]: T }): T;
declare function f12<T, U>(x: T | U): [T, U];
declare function f13<T, U>(x: T & U): [T, U];
declare function f14<T, U>(x: { a: T | U, b: U & T }): [T, U];
interface I<T> { }
declare function f15<T>(x: I<T>): T;
declare function f16<T>(x: Partial<T>): T;
declare function f17<T, K>(x: {[P in keyof T]: K}): T;
declare function f18<T, K extends keyof T>(x: {[P in K]: T[P]}): T;
declare function f19<T, K extends keyof T>(k: K, x: T[K]): T;
// @fileName: a.js
var a = f1(a);
var a = f2(a);
var t = f3(a);
var a = f4(a);
var a = f5(a);
var a = f6(a);
var a = f7(a);
var a = f8(a);
var a = f9(a);
var a = f10(a);
var a = f11(a);
var t = f12(a);
var t = f13(a);
var t = f14(a);
var a = f15(a);
var a = f16(a);
var a = f17(a);
var a = f18(a);
var a = f19(a, a);
@@ -1,13 +1,13 @@
/// <reference path='fourslash.ts' />
// @Filename: indents.ts
/////*0*/
//// a /*2*/
//// /*1*/
//// /*2*/function foo() { }
/////*0*/ function foo() { }
const noIndentEmptyScaffolding = "/**\r\n * \r\n */";
const oneIndentEmptyScaffolding = "/**\r\n * \r\n */";
const twoIndentEmptyScaffolding = "/**\r\n * \r\n */\r\n ";
const twoIndentEmptyScaffolding = "/**\r\n * \r\n */";
const noIndentOffset = 8;
const oneIndentOffset = noIndentOffset + 4;
const twoIndentOffset = oneIndentOffset + 4;
@@ -19,4 +19,4 @@ goTo.marker("1");
verify.DocCommentTemplate(oneIndentEmptyScaffolding, oneIndentOffset);
goTo.marker("2");
verify.DocCommentTemplate(twoIndentEmptyScaffolding, twoIndentOffset);
verify.DocCommentTemplate(twoIndentEmptyScaffolding, twoIndentOffset);
+44
View File
@@ -0,0 +1,44 @@
/// <reference path='fourslash.ts' />
//@module: commonjs
//@jsx: preserve
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// }
//// interface ElementAttributesProperty { props; }
//// }
//@Filename: exporter.tsx
//// export class Thing { props: { ONE: string; TWO: number } }
//// export module M {
//// export declare function SFCComp(props: { Three: number; Four: string }): JSX.Element;
//// }
//@Filename: file.tsx
//// import * as Exp from './exporter';
//// var x1 = <Exp.Thing /*1*/ />;
//// var x2 = <Exp.M.SFCComp /*2*/ />;
//// var x3 = <Exp.Thing /*3*/ ></Exp.Thing>;
//// var x4 = <Exp.M.SFCComp /*4*/ ></Exp.M.SFCComp>;
goTo.marker("1");
verify.completionListCount(2);
verify.completionListContains('ONE');
verify.completionListContains('TWO');
goTo.marker("2");
verify.completionListCount(2);
verify.completionListContains("Three");
verify.completionListContains("Four");
goTo.marker("3");
verify.completionListCount(2);
verify.completionListContains('ONE');
verify.completionListContains('TWO');
goTo.marker("4");
verify.completionListCount(2);
verify.completionListContains("Three");
verify.completionListContains("Four");