mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge remote-tracking branch 'upstream/master' into javaScriptPrototypes
This commit is contained in:
+4
-2
@@ -36,11 +36,13 @@ Your pull request should:
|
||||
|
||||
The library sources are in: [src/lib](https://github.com/Microsoft/TypeScript/tree/master/src/lib)
|
||||
|
||||
To build the library files, run
|
||||
Library files in `built/local/` are updated by running
|
||||
```Shell
|
||||
jake lib
|
||||
jake
|
||||
```
|
||||
|
||||
The files in `lib/` are used to bootstrap compilation and usually do not need to be updated.
|
||||
|
||||
#### `src/lib/dom.generated.d.ts` and `src/lib/webworker.generated.d.ts`
|
||||
|
||||
These two files represent the DOM typings and are auto-generated. To make any modifications to them, please submit a PR to https://github.com/Microsoft/TSJS-lib-generator
|
||||
|
||||
+9
-3
@@ -113,7 +113,8 @@ var scriptSources = [
|
||||
"tslint/nextLineRule.ts",
|
||||
"tslint/noNullRule.ts",
|
||||
"tslint/preferConstRule.ts",
|
||||
"tslint/typeOperatorSpacingRule.ts"
|
||||
"tslint/typeOperatorSpacingRule.ts",
|
||||
"tslint/noInOperatorRule.ts"
|
||||
].map(function (f) {
|
||||
return path.join(scriptsDirectory, f);
|
||||
});
|
||||
@@ -875,7 +876,8 @@ var tslintRules = ([
|
||||
"noNullRule",
|
||||
"preferConstRule",
|
||||
"booleanTriviaRule",
|
||||
"typeOperatorSpacingRule"
|
||||
"typeOperatorSpacingRule",
|
||||
"noInOperatorRule"
|
||||
]);
|
||||
var tslintRulesFiles = tslintRules.map(function(p) {
|
||||
return path.join(tslintRuleDir, p + ".ts");
|
||||
@@ -926,13 +928,17 @@ var lintTargets = compilerSources
|
||||
desc("Runs tslint on the compiler sources");
|
||||
task("lint", ["build-rules"], function() {
|
||||
var lintOptions = getLinterOptions();
|
||||
var failed = 0;
|
||||
for (var i in lintTargets) {
|
||||
var result = lintFile(lintOptions, lintTargets[i]);
|
||||
if (result.failureCount > 0) {
|
||||
console.log(result.output);
|
||||
fail('Linter errors.', result.failureCount);
|
||||
failed += result.failureCount;
|
||||
}
|
||||
}
|
||||
if (failed > 0) {
|
||||
fail('Linter errors.', failed);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+1
-1
@@ -1323,7 +1323,7 @@ x = "hello"; // Ok
|
||||
x = 42; // Ok
|
||||
x = test; // Error, boolean not assignable
|
||||
x = test ? 5 : "five"; // Ok
|
||||
x = test ? 0 : false; // Error, number | boolean not asssignable
|
||||
x = test ? 0 : false; // Error, number | boolean not assignable
|
||||
```
|
||||
|
||||
it is possible to assign 'x' a value of type `string`, `number`, or the union type `string | number`, but not any other type. To access a value in 'x', a type guard can be used to first narrow the type of 'x' to either `string` or `number`:
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Read this!
|
||||
|
||||
These files are not meant to be edited by hand.
|
||||
If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory.
|
||||
If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory. Running `jake LKG` will then appropriately update the files in this directory.
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import * as Lint from "tslint/lib/lint";
|
||||
import * as ts from "typescript";
|
||||
|
||||
|
||||
export class Rule extends Lint.Rules.AbstractRule {
|
||||
public static FAILURE_STRING = "Don't use the 'in' keyword - use 'hasProperty' to check for key presence instead";
|
||||
|
||||
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
|
||||
return this.applyWithWalker(new InWalker(sourceFile, this.getOptions()));
|
||||
}
|
||||
}
|
||||
|
||||
class InWalker extends Lint.RuleWalker {
|
||||
visitNode(node: ts.Node) {
|
||||
super.visitNode(node);
|
||||
if (node.kind === ts.SyntaxKind.InKeyword && node.parent && node.parent.kind === ts.SyntaxKind.BinaryExpression) {
|
||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING));
|
||||
}
|
||||
}
|
||||
}
|
||||
+121
-97
@@ -141,9 +141,6 @@ namespace ts {
|
||||
let globalRegExpType: ObjectType;
|
||||
let globalTemplateStringsArrayType: ObjectType;
|
||||
let globalESSymbolType: ObjectType;
|
||||
let jsxElementType: ObjectType;
|
||||
/** Lazily loaded, use getJsxIntrinsicElementType() */
|
||||
let jsxIntrinsicElementsType: ObjectType;
|
||||
let globalIterableType: GenericType;
|
||||
let globalIteratorType: GenericType;
|
||||
let globalIterableIteratorType: GenericType;
|
||||
@@ -208,12 +205,17 @@ namespace ts {
|
||||
}
|
||||
};
|
||||
|
||||
let jsxElementType: ObjectType;
|
||||
/** Things we lazy load from the JSX namespace */
|
||||
const jsxTypes: Map<ObjectType> = {};
|
||||
const JsxNames = {
|
||||
JSX: "JSX",
|
||||
IntrinsicElements: "IntrinsicElements",
|
||||
ElementClass: "ElementClass",
|
||||
ElementAttributesPropertyNameContainer: "ElementAttributesProperty",
|
||||
Element: "Element"
|
||||
Element: "Element",
|
||||
IntrinsicAttributes: "IntrinsicAttributes",
|
||||
IntrinsicClassAttributes: "IntrinsicClassAttributes"
|
||||
};
|
||||
|
||||
const subtypeRelation: Map<RelationComparisonResult> = {};
|
||||
@@ -377,6 +379,14 @@ namespace ts {
|
||||
return node.kind === SyntaxKind.SourceFile && !isExternalOrCommonJsModule(<SourceFile>node);
|
||||
}
|
||||
|
||||
/** Is this type one of the apparent types created from the primitive types. */
|
||||
function isPrimitiveApparentType(type: Type): boolean {
|
||||
return type === globalStringType ||
|
||||
type === globalNumberType ||
|
||||
type === globalBooleanType ||
|
||||
type === globalESSymbolType;
|
||||
}
|
||||
|
||||
function getSymbol(symbols: SymbolTable, name: string, meaning: SymbolFlags): Symbol {
|
||||
if (meaning && hasProperty(symbols, name)) {
|
||||
const symbol = symbols[name];
|
||||
@@ -1519,9 +1529,9 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string {
|
||||
function signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string {
|
||||
const writer = getSingleLineStringWriter();
|
||||
getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags);
|
||||
getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind);
|
||||
const result = writer.string();
|
||||
releaseStringWriter(writer);
|
||||
|
||||
@@ -1873,7 +1883,7 @@ namespace ts {
|
||||
if (flags & TypeFormatFlags.InElementType) {
|
||||
writePunctuation(writer, SyntaxKind.OpenParenToken);
|
||||
}
|
||||
buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | TypeFormatFlags.WriteArrowStyleSignature, symbolStack);
|
||||
buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | TypeFormatFlags.WriteArrowStyleSignature, /*kind*/ undefined, symbolStack);
|
||||
if (flags & TypeFormatFlags.InElementType) {
|
||||
writePunctuation(writer, SyntaxKind.CloseParenToken);
|
||||
}
|
||||
@@ -1885,7 +1895,7 @@ namespace ts {
|
||||
}
|
||||
writeKeyword(writer, SyntaxKind.NewKeyword);
|
||||
writeSpace(writer);
|
||||
buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | TypeFormatFlags.WriteArrowStyleSignature, symbolStack);
|
||||
buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | TypeFormatFlags.WriteArrowStyleSignature, /*kind*/ undefined, symbolStack);
|
||||
if (flags & TypeFormatFlags.InElementType) {
|
||||
writePunctuation(writer, SyntaxKind.CloseParenToken);
|
||||
}
|
||||
@@ -1899,15 +1909,12 @@ namespace ts {
|
||||
writer.writeLine();
|
||||
writer.increaseIndent();
|
||||
for (const signature of resolved.callSignatures) {
|
||||
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack);
|
||||
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack);
|
||||
writePunctuation(writer, SyntaxKind.SemicolonToken);
|
||||
writer.writeLine();
|
||||
}
|
||||
for (const signature of resolved.constructSignatures) {
|
||||
writeKeyword(writer, SyntaxKind.NewKeyword);
|
||||
writeSpace(writer);
|
||||
|
||||
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack);
|
||||
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, SignatureKind.Construct, symbolStack);
|
||||
writePunctuation(writer, SyntaxKind.SemicolonToken);
|
||||
writer.writeLine();
|
||||
}
|
||||
@@ -1948,7 +1955,7 @@ namespace ts {
|
||||
if (p.flags & SymbolFlags.Optional) {
|
||||
writePunctuation(writer, SyntaxKind.QuestionToken);
|
||||
}
|
||||
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack);
|
||||
buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack);
|
||||
writePunctuation(writer, SyntaxKind.SemicolonToken);
|
||||
writer.writeLine();
|
||||
}
|
||||
@@ -2068,7 +2075,12 @@ namespace ts {
|
||||
buildTypeDisplay(returnType, writer, enclosingDeclaration, flags, symbolStack);
|
||||
}
|
||||
|
||||
function buildSignatureDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) {
|
||||
function buildSignatureDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind, symbolStack?: Symbol[]) {
|
||||
if (kind === SignatureKind.Construct) {
|
||||
writeKeyword(writer, SyntaxKind.NewKeyword);
|
||||
writeSpace(writer);
|
||||
}
|
||||
|
||||
if (signature.target && (flags & TypeFormatFlags.WriteTypeArgumentsOfSignature)) {
|
||||
// Instantiated signature, write type arguments instead
|
||||
// This is achieved by passing in the mapper separately
|
||||
@@ -5114,9 +5126,6 @@ namespace ts {
|
||||
}
|
||||
return objectTypeRelatedTo(source, source, target, /*reportErrors*/ false);
|
||||
}
|
||||
if (source.flags & TypeFlags.TypeParameter && target.flags & TypeFlags.TypeParameter) {
|
||||
return typeParameterIdenticalTo(<TypeParameter>source, <TypeParameter>target);
|
||||
}
|
||||
if (source.flags & TypeFlags.Union && target.flags & TypeFlags.Union ||
|
||||
source.flags & TypeFlags.Intersection && target.flags & TypeFlags.Intersection) {
|
||||
if (result = eachTypeRelatedToSomeType(<UnionOrIntersectionType>source, <UnionOrIntersectionType>target)) {
|
||||
@@ -5247,17 +5256,6 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function typeParameterIdenticalTo(source: TypeParameter, target: TypeParameter): Ternary {
|
||||
// covers case when both type parameters does not have constraint (both equal to noConstraintType)
|
||||
if (source.constraint === target.constraint) {
|
||||
return Ternary.True;
|
||||
}
|
||||
if (source.constraint === noConstraintType || target.constraint === noConstraintType) {
|
||||
return Ternary.False;
|
||||
}
|
||||
return isIdenticalTo(source.constraint, target.constraint);
|
||||
}
|
||||
|
||||
// Determine if two object types are related by structure. First, check if the result is already available in the global cache.
|
||||
// Second, check if we have already started a comparison of the given two types in which case we assume the result to be true.
|
||||
// Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are
|
||||
@@ -5483,20 +5481,26 @@ namespace ts {
|
||||
|
||||
outer: for (const t of targetSignatures) {
|
||||
if (!t.hasStringLiterals || target.flags & TypeFlags.FromSignature) {
|
||||
let localErrors = reportErrors;
|
||||
const checkedAbstractAssignability = false;
|
||||
// Only elaborate errors from the first failure
|
||||
let shouldElaborateErrors = reportErrors;
|
||||
for (const s of sourceSignatures) {
|
||||
if (!s.hasStringLiterals || source.flags & TypeFlags.FromSignature) {
|
||||
const related = signatureRelatedTo(s, t, localErrors);
|
||||
const related = signatureRelatedTo(s, t, shouldElaborateErrors);
|
||||
if (related) {
|
||||
result &= related;
|
||||
errorInfo = saveErrorInfo;
|
||||
continue outer;
|
||||
}
|
||||
// Only report errors from the first failure
|
||||
localErrors = false;
|
||||
shouldElaborateErrors = false;
|
||||
}
|
||||
}
|
||||
// don't elaborate the primitive apparent types (like Number)
|
||||
// because the actual primitives will have already been reported.
|
||||
if (shouldElaborateErrors && !isPrimitiveApparentType(source)) {
|
||||
reportError(Diagnostics.Type_0_provides_no_match_for_the_signature_1,
|
||||
typeToString(source),
|
||||
signatureToString(t, /*enclosingDeclaration*/ undefined, /*flags*/ undefined, kind));
|
||||
}
|
||||
return Ternary.False;
|
||||
}
|
||||
}
|
||||
@@ -5806,26 +5810,19 @@ namespace ts {
|
||||
if (!(isMatchingSignature(source, target, partialMatch))) {
|
||||
return Ternary.False;
|
||||
}
|
||||
let result = Ternary.True;
|
||||
if (source.typeParameters && target.typeParameters) {
|
||||
if (source.typeParameters.length !== target.typeParameters.length) {
|
||||
return Ternary.False;
|
||||
}
|
||||
for (let i = 0, len = source.typeParameters.length; i < len; ++i) {
|
||||
const related = compareTypes(source.typeParameters[i], target.typeParameters[i]);
|
||||
if (!related) {
|
||||
return Ternary.False;
|
||||
}
|
||||
result &= related;
|
||||
}
|
||||
}
|
||||
else if (source.typeParameters || target.typeParameters) {
|
||||
// Check that the two signatures have the same number of type parameters. We might consider
|
||||
// also checking that any type parameter constraints match, but that would require instantiating
|
||||
// the constraints with a common set of type arguments to get relatable entities in places where
|
||||
// type parameters occur in the constraints. The complexity of doing that doesn't seem worthwhile,
|
||||
// particularly as we're comparing erased versions of the signatures below.
|
||||
if ((source.typeParameters ? source.typeParameters.length : 0) !== (target.typeParameters ? target.typeParameters.length : 0)) {
|
||||
return Ternary.False;
|
||||
}
|
||||
// Spec 1.0 Section 3.8.3 & 3.8.4:
|
||||
// M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N
|
||||
source = getErasedSignature(source);
|
||||
target = getErasedSignature(target);
|
||||
let result = Ternary.True;
|
||||
const targetLen = target.parameters.length;
|
||||
for (let i = 0; i < targetLen; i++) {
|
||||
const s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]);
|
||||
@@ -7921,12 +7918,11 @@ namespace ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
/// Returns the type JSX.IntrinsicElements. May return `unknownType` if that type is not present.
|
||||
function getJsxIntrinsicElementsType() {
|
||||
if (!jsxIntrinsicElementsType) {
|
||||
jsxIntrinsicElementsType = getExportedTypeFromNamespace(JsxNames.JSX, JsxNames.IntrinsicElements) || unknownType;
|
||||
function getJsxType(name: string) {
|
||||
if (jsxTypes[name] === undefined) {
|
||||
return jsxTypes[name] = getExportedTypeFromNamespace(JsxNames.JSX, name) || unknownType;
|
||||
}
|
||||
return jsxIntrinsicElementsType;
|
||||
return jsxTypes[name];
|
||||
}
|
||||
|
||||
/// Given a JSX opening element or self-closing element, return the symbol of the property that the tag name points to if
|
||||
@@ -7949,7 +7945,7 @@ namespace ts {
|
||||
return links.resolvedSymbol;
|
||||
|
||||
function lookupIntrinsicTag(node: JsxOpeningLikeElement | JsxClosingElement): Symbol {
|
||||
const intrinsicElementsType = getJsxIntrinsicElementsType();
|
||||
const intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements);
|
||||
if (intrinsicElementsType !== unknownType) {
|
||||
// Property case
|
||||
const intrinsicProp = getPropertyOfType(intrinsicElementsType, (<Identifier>node.tagName).text);
|
||||
@@ -7981,7 +7977,7 @@ namespace ts {
|
||||
|
||||
// Look up the value in the current scope
|
||||
if (valueSymbol && valueSymbol !== unknownSymbol) {
|
||||
links.jsxFlags |= JsxFlags.ClassElement;
|
||||
links.jsxFlags |= JsxFlags.ValueElement;
|
||||
if (valueSymbol.flags & SymbolFlags.Alias) {
|
||||
markAliasSymbolAsReferenced(valueSymbol);
|
||||
}
|
||||
@@ -8010,7 +8006,7 @@ namespace ts {
|
||||
function getJsxElementInstanceType(node: JsxOpeningLikeElement) {
|
||||
// There is no such thing as an instance type for a non-class element. This
|
||||
// line shouldn't be hit.
|
||||
Debug.assert(!!(getNodeLinks(node).jsxFlags & JsxFlags.ClassElement), "Should not call getJsxElementInstanceType on non-class Element");
|
||||
Debug.assert(!!(getNodeLinks(node).jsxFlags & JsxFlags.ValueElement), "Should not call getJsxElementInstanceType on non-class Element");
|
||||
|
||||
const classSymbol = getJsxElementTagSymbol(node);
|
||||
if (classSymbol === unknownSymbol) {
|
||||
@@ -8037,15 +8033,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
const returnType = getUnionType(signatures.map(getReturnTypeOfSignature));
|
||||
|
||||
// Issue an error if this return type isn't assignable to JSX.ElementClass
|
||||
const elemClassType = getJsxGlobalElementClassType();
|
||||
if (elemClassType) {
|
||||
checkTypeRelatedTo(returnType, elemClassType, assignableRelation, node, Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements);
|
||||
}
|
||||
|
||||
return returnType;
|
||||
return getUnionType(signatures.map(getReturnTypeOfSignature));
|
||||
}
|
||||
|
||||
/// e.g. "props" for React.d.ts,
|
||||
@@ -8094,9 +8082,31 @@ namespace ts {
|
||||
if (!links.resolvedJsxType) {
|
||||
const sym = getJsxElementTagSymbol(node);
|
||||
|
||||
if (links.jsxFlags & JsxFlags.ClassElement) {
|
||||
if (links.jsxFlags & JsxFlags.ValueElement) {
|
||||
// Get the element instance type (the result of newing or invoking this tag)
|
||||
const elemInstanceType = getJsxElementInstanceType(node);
|
||||
|
||||
// Is this is a stateless function component? See if its single signature is
|
||||
// assignable to the JSX Element Type
|
||||
const callSignature = getSingleCallSignature(getTypeOfSymbol(sym));
|
||||
const callReturnType = callSignature && getReturnTypeOfSignature(callSignature);
|
||||
let paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0]));
|
||||
if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType) && (paramType.flags & TypeFlags.ObjectType)) {
|
||||
// Intersect in JSX.IntrinsicAttributes if it exists
|
||||
const intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes);
|
||||
if (intrinsicAttributes !== unknownType) {
|
||||
paramType = intersectTypes(intrinsicAttributes, paramType);
|
||||
}
|
||||
return paramType;
|
||||
}
|
||||
|
||||
// Issue an error if this return type isn't assignable to JSX.ElementClass
|
||||
const elemClassType = getJsxGlobalElementClassType();
|
||||
if (elemClassType) {
|
||||
checkTypeRelatedTo(elemInstanceType, elemClassType, assignableRelation, node, Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements);
|
||||
}
|
||||
|
||||
|
||||
if (isTypeAny(elemInstanceType)) {
|
||||
return links.resolvedJsxType = elemInstanceType;
|
||||
}
|
||||
@@ -8118,14 +8128,36 @@ namespace ts {
|
||||
return links.resolvedJsxType = emptyObjectType;
|
||||
}
|
||||
else if (isTypeAny(attributesType) || (attributesType === unknownType)) {
|
||||
// Props is of type 'any' or unknown
|
||||
return links.resolvedJsxType = attributesType;
|
||||
}
|
||||
else if (!(attributesType.flags & TypeFlags.ObjectType)) {
|
||||
// Props is not an object type
|
||||
error(node.tagName, Diagnostics.JSX_element_attributes_type_0_must_be_an_object_type, typeToString(attributesType));
|
||||
return links.resolvedJsxType = anyType;
|
||||
}
|
||||
else {
|
||||
return links.resolvedJsxType = attributesType;
|
||||
// Normal case -- add in IntrinsicClassElements<T> and IntrinsicElements
|
||||
let apparentAttributesType = attributesType;
|
||||
const intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes);
|
||||
if (intrinsicClassAttribs !== unknownType) {
|
||||
const typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);
|
||||
if (typeParams) {
|
||||
if (typeParams.length === 1) {
|
||||
apparentAttributesType = intersectTypes(createTypeReference(<GenericType>intrinsicClassAttribs, [elemInstanceType]), apparentAttributesType);
|
||||
}
|
||||
}
|
||||
else {
|
||||
apparentAttributesType = intersectTypes(attributesType, intrinsicClassAttribs);
|
||||
}
|
||||
}
|
||||
|
||||
const intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes);
|
||||
if (intrinsicAttribs !== unknownType) {
|
||||
apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType);
|
||||
}
|
||||
|
||||
return links.resolvedJsxType = apparentAttributesType;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8164,7 +8196,7 @@ namespace ts {
|
||||
|
||||
/// Returns all the properties of the Jsx.IntrinsicElements interface
|
||||
function getJsxIntrinsicTagNames(): Symbol[] {
|
||||
const intrinsics = getJsxIntrinsicElementsType();
|
||||
const intrinsics = getJsxType(JsxNames.IntrinsicElements);
|
||||
return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray;
|
||||
}
|
||||
|
||||
@@ -9905,7 +9937,7 @@ namespace ts {
|
||||
return aggregatedTypes;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
*TypeScript Specification 1.0 (6.3) - July 2014
|
||||
* An explicitly typed function whose return type isn't the Void or the Any type
|
||||
* must have at least one return statement somewhere in its body.
|
||||
@@ -9931,15 +9963,15 @@ namespace ts {
|
||||
const hasExplicitReturn = func.flags & NodeFlags.HasExplicitReturn;
|
||||
|
||||
if (returnType && !hasExplicitReturn) {
|
||||
// minimal check: function has syntactic return type annotation and no explicit return statements in the body
|
||||
// minimal check: function has syntactic return type annotation and no explicit return statements in the body
|
||||
// this function does not conform to the specification.
|
||||
// NOTE: having returnType !== undefined is a precondition for entering this branch so func.type will always be present
|
||||
// NOTE: having returnType !== undefined is a precondition for entering this branch so func.type will always be present
|
||||
error(func.type, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);
|
||||
}
|
||||
else if (compilerOptions.noImplicitReturns) {
|
||||
if (!returnType) {
|
||||
// If return type annotation is omitted check if function has any explicit return statements.
|
||||
// If it does not have any - its inferred return type is void - don't do any checks.
|
||||
// If it does not have any - its inferred return type is void - don't do any checks.
|
||||
// Otherwise get inferred return type from function body and report error only if it is not void / anytype
|
||||
const inferredReturnType = hasExplicitReturn
|
||||
? getReturnTypeOfSignature(getSignatureFromDeclaration(func))
|
||||
@@ -11969,6 +12001,9 @@ namespace ts {
|
||||
return unknownType;
|
||||
}
|
||||
|
||||
// If the Promise constructor, resolved locally, is an alias symbol we should mark it as referenced.
|
||||
checkReturnTypeAnnotationAsExpression(node);
|
||||
|
||||
// Validate the promise constructor type.
|
||||
const promiseConstructorType = getTypeOfSymbol(promiseConstructor);
|
||||
if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node, Diagnostics.Type_0_is_not_a_valid_async_function_return_type)) {
|
||||
@@ -11977,11 +12012,11 @@ namespace ts {
|
||||
|
||||
// Verify there is no local declaration that could collide with the promise constructor.
|
||||
const promiseName = getEntityNameFromTypeNode(node.type);
|
||||
const root = getFirstIdentifier(promiseName);
|
||||
const rootSymbol = getSymbol(node.locals, root.text, SymbolFlags.Value);
|
||||
const promiseNameOrNamespaceRoot = getFirstIdentifier(promiseName);
|
||||
const rootSymbol = getSymbol(node.locals, promiseNameOrNamespaceRoot.text, SymbolFlags.Value);
|
||||
if (rootSymbol) {
|
||||
error(rootSymbol.valueDeclaration, Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions,
|
||||
root.text,
|
||||
promiseNameOrNamespaceRoot.text,
|
||||
getFullyQualifiedName(promiseConstructor));
|
||||
return unknownType;
|
||||
}
|
||||
@@ -12065,24 +12100,12 @@ namespace ts {
|
||||
* Checks the type annotation of an accessor declaration or property declaration as
|
||||
* an expression if it is a type reference to a type with a value declaration.
|
||||
*/
|
||||
function checkTypeAnnotationAsExpression(node: AccessorDeclaration | PropertyDeclaration | ParameterDeclaration | MethodDeclaration) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
checkTypeNodeAsExpression((<PropertyDeclaration>node).type);
|
||||
break;
|
||||
case SyntaxKind.Parameter:
|
||||
checkTypeNodeAsExpression((<ParameterDeclaration>node).type);
|
||||
break;
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
checkTypeNodeAsExpression((<MethodDeclaration>node).type);
|
||||
break;
|
||||
case SyntaxKind.GetAccessor:
|
||||
checkTypeNodeAsExpression((<AccessorDeclaration>node).type);
|
||||
break;
|
||||
case SyntaxKind.SetAccessor:
|
||||
checkTypeNodeAsExpression(getSetAccessorTypeAnnotationNode(<AccessorDeclaration>node));
|
||||
break;
|
||||
}
|
||||
function checkTypeAnnotationAsExpression(node: VariableLikeDeclaration) {
|
||||
checkTypeNodeAsExpression((<PropertyDeclaration>node).type);
|
||||
}
|
||||
|
||||
function checkReturnTypeAnnotationAsExpression(node: FunctionLikeDeclaration) {
|
||||
checkTypeNodeAsExpression(node.type);
|
||||
}
|
||||
|
||||
/** Checks the type annotation of the parameters of a function/method or the constructor of a class as expressions */
|
||||
@@ -12120,11 +12143,12 @@ namespace ts {
|
||||
break;
|
||||
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
checkParameterTypeAnnotationsAsExpressions(<FunctionLikeDeclaration>node);
|
||||
// fall-through
|
||||
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
checkParameterTypeAnnotationsAsExpressions(<FunctionLikeDeclaration>node);
|
||||
checkReturnTypeAnnotationAsExpression(<FunctionLikeDeclaration>node);
|
||||
break;
|
||||
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.Parameter:
|
||||
checkTypeAnnotationAsExpression(<PropertyDeclaration | ParameterDeclaration>node);
|
||||
|
||||
@@ -1675,7 +1675,7 @@ namespace ts {
|
||||
/* @internal */
|
||||
export function writeDeclarationFile(declarationFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean, host: EmitHost, resolver: EmitResolver, emitterDiagnostics: DiagnosticCollection) {
|
||||
const emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit);
|
||||
const emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath);
|
||||
const emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit;
|
||||
if (!emitSkipped) {
|
||||
const declarationOutput = emitDeclarationResult.referencePathsOutput
|
||||
+ getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo);
|
||||
|
||||
@@ -1732,6 +1732,10 @@
|
||||
"category": "Error",
|
||||
"code": 2657
|
||||
},
|
||||
"Type '{0}' provides no match for the signature '{1}'": {
|
||||
"category": "Error",
|
||||
"code": 2658
|
||||
},
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4000
|
||||
|
||||
+40
-42
@@ -2190,7 +2190,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emit(node.right);
|
||||
}
|
||||
|
||||
function emitEntityNameAsExpression(node: EntityName, useFallback: boolean) {
|
||||
function emitEntityNameAsExpression(node: EntityName | Expression, useFallback: boolean) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
if (useFallback) {
|
||||
@@ -2205,6 +2205,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
case SyntaxKind.QualifiedName:
|
||||
emitQualifiedNameAsExpression(<QualifiedName>node, useFallback);
|
||||
break;
|
||||
|
||||
default:
|
||||
emitNodeWithoutSourceMap(node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2978,7 +2982,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
else {
|
||||
// this is top level converted loop so we need to create an alias for 'this' here
|
||||
// NOTE:
|
||||
// NOTE:
|
||||
// if converted loops were all nested in arrow function then we'll always emit '_this' so convertedLoopState.thisName will not be set.
|
||||
// If it is set this means that all nested loops are not nested in arrow function and it is safe to capture 'this'.
|
||||
write(`var ${convertedLoopState.thisName} = this;`);
|
||||
@@ -3624,12 +3628,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
// only allow export default at a source file level
|
||||
if (modulekind === ModuleKind.CommonJS || modulekind === ModuleKind.AMD || modulekind === ModuleKind.UMD) {
|
||||
if (!isEs6Module) {
|
||||
if (languageVersion === ScriptTarget.ES5) {
|
||||
if (languageVersion !== ScriptTarget.ES3) {
|
||||
// default value of configurable, enumerable, writable are `false`.
|
||||
write("Object.defineProperty(exports, \"__esModule\", { value: true });");
|
||||
writeLine();
|
||||
}
|
||||
else if (languageVersion === ScriptTarget.ES3) {
|
||||
else {
|
||||
write("exports.__esModule = true;");
|
||||
writeLine();
|
||||
}
|
||||
@@ -4273,7 +4277,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
if (node.kind === SyntaxKind.FunctionDeclaration) {
|
||||
// Emit name if one is present, or emit generated name in down-level case (for export default case)
|
||||
return !!node.name || languageVersion < ScriptTarget.ES6;
|
||||
return !!node.name || modulekind !== ModuleKind.ES6;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4455,18 +4459,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
write(" __awaiter(this");
|
||||
if (hasLexicalArguments) {
|
||||
write(", arguments");
|
||||
write(", arguments, ");
|
||||
}
|
||||
else {
|
||||
write(", void 0");
|
||||
write(", void 0, ");
|
||||
}
|
||||
|
||||
if (promiseConstructor) {
|
||||
write(", ");
|
||||
emitNodeWithoutSourceMap(promiseConstructor);
|
||||
emitEntityNameAsExpression(promiseConstructor, /*useFallback*/ false);
|
||||
}
|
||||
else {
|
||||
write(", Promise");
|
||||
write("Promise");
|
||||
}
|
||||
|
||||
// Emit the call to __awaiter.
|
||||
@@ -4527,7 +4530,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
const isAsync = isAsyncFunctionLike(node);
|
||||
if (isAsync && languageVersion === ScriptTarget.ES6) {
|
||||
if (isAsync) {
|
||||
emitAsyncFunctionBodyForES6(node);
|
||||
}
|
||||
else {
|
||||
@@ -5108,7 +5111,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
// emit name if
|
||||
// - node has a name
|
||||
// - this is default export with static initializers
|
||||
if ((node.name || (node.flags & NodeFlags.Default && staticProperties.length > 0)) && !thisNodeIsDecorated) {
|
||||
if ((node.name || (node.flags & NodeFlags.Default && (staticProperties.length > 0 || modulekind !== ModuleKind.ES6))) && !thisNodeIsDecorated) {
|
||||
write(" ");
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
@@ -5168,35 +5171,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
return;
|
||||
}
|
||||
// If this is an exported class, but not on the top level (i.e. on an internal
|
||||
// module), export it
|
||||
if (node.flags & NodeFlags.Default) {
|
||||
// if this is a top level default export of decorated class, write the export after the declaration.
|
||||
writeLine();
|
||||
if (thisNodeIsDecorated && modulekind === ModuleKind.ES6) {
|
||||
write("export default ");
|
||||
emitDeclarationName(node);
|
||||
write(";");
|
||||
}
|
||||
else if (modulekind === ModuleKind.System) {
|
||||
write(`${exportFunctionForFile}("default", `);
|
||||
emitDeclarationName(node);
|
||||
write(");");
|
||||
}
|
||||
else if (modulekind !== ModuleKind.ES6) {
|
||||
write(`exports.default = `);
|
||||
emitDeclarationName(node);
|
||||
write(";");
|
||||
}
|
||||
if (modulekind !== ModuleKind.ES6) {
|
||||
emitExportMemberAssignment(node as ClassDeclaration);
|
||||
}
|
||||
else if (node.parent.kind !== SyntaxKind.SourceFile || (modulekind !== ModuleKind.ES6 && !(node.flags & NodeFlags.Default))) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
emitModuleMemberName(node);
|
||||
write(" = ");
|
||||
emitDeclarationName(node);
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
else {
|
||||
// If this is an exported class, but not on the top level (i.e. on an internal
|
||||
// module), export it
|
||||
if (node.flags & NodeFlags.Default) {
|
||||
// if this is a top level default export of decorated class, write the export after the declaration.
|
||||
if (thisNodeIsDecorated) {
|
||||
writeLine();
|
||||
write("export default ");
|
||||
emitDeclarationName(node);
|
||||
write(";");
|
||||
}
|
||||
}
|
||||
else if (node.parent.kind !== SyntaxKind.SourceFile) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
emitModuleMemberName(node);
|
||||
write(" = ");
|
||||
emitDeclarationName(node);
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5729,7 +5727,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
/** Serializes the return type of function. Used by the __metadata decorator for a method. */
|
||||
function emitSerializedReturnTypeOfNode(node: Node): string | string[] {
|
||||
function emitSerializedReturnTypeOfNode(node: Node) {
|
||||
if (node && isFunctionLike(node) && (<FunctionLikeDeclaration>node).type) {
|
||||
emitSerializedTypeNode((<FunctionLikeDeclaration>node).type);
|
||||
return;
|
||||
@@ -7823,7 +7821,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
function emitFile({ jsFilePath, sourceMapFilePath, declarationFilePath}: { jsFilePath: string, sourceMapFilePath: string, declarationFilePath: string },
|
||||
sourceFiles: SourceFile[], isBundledEmit: boolean) {
|
||||
// Make sure not to write js File and source map file if any of them cannot be written
|
||||
if (!host.isEmitBlocked(jsFilePath)) {
|
||||
if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) {
|
||||
emitJavaScript(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -661,19 +661,17 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getSemanticDiagnosticsForFile(sourceFile: SourceFile, cancellationToken: CancellationToken): Diagnostic[] {
|
||||
// For JavaScript files, we don't want to report the normal typescript semantic errors.
|
||||
// Instead, we just report errors for using TypeScript-only constructs from within a
|
||||
// JavaScript file.
|
||||
if (isSourceFileJavaScript(sourceFile)) {
|
||||
return getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken);
|
||||
}
|
||||
|
||||
return runWithCancellationToken(() => {
|
||||
const typeChecker = getDiagnosticsProducingTypeChecker();
|
||||
|
||||
Debug.assert(!!sourceFile.bindDiagnostics);
|
||||
const bindDiagnostics = sourceFile.bindDiagnostics;
|
||||
const checkDiagnostics = typeChecker.getDiagnostics(sourceFile, cancellationToken);
|
||||
// For JavaScript files, we don't want to report the normal typescript semantic errors.
|
||||
// Instead, we just report errors for using TypeScript-only constructs from within a
|
||||
// JavaScript file.
|
||||
const checkDiagnostics = isSourceFileJavaScript(sourceFile) ?
|
||||
getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) :
|
||||
typeChecker.getDiagnostics(sourceFile, cancellationToken);
|
||||
const fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName);
|
||||
const programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
|
||||
|
||||
@@ -1079,6 +1077,8 @@ namespace ts {
|
||||
const importedFile = findSourceFile(resolution.resolvedFileName, toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /*isDefaultLib*/ false, file, skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
|
||||
|
||||
if (importedFile && resolution.isExternalLibraryImport) {
|
||||
// Since currently irrespective of allowJs, we only look for supportedTypeScript extension external module files,
|
||||
// this check is ok. Otherwise this would be never true for javascript file
|
||||
if (!isExternalModule(importedFile)) {
|
||||
const start = getTokenPosOfNode(file.imports[i], file);
|
||||
fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName));
|
||||
|
||||
@@ -439,12 +439,16 @@ namespace ts {
|
||||
|
||||
export const enum JsxFlags {
|
||||
None = 0,
|
||||
/** An element from a named property of the JSX.IntrinsicElements interface */
|
||||
IntrinsicNamedElement = 1 << 0,
|
||||
/** An element inferred from the string index signature of the JSX.IntrinsicElements interface */
|
||||
IntrinsicIndexedElement = 1 << 1,
|
||||
ClassElement = 1 << 2,
|
||||
UnknownElement = 1 << 3,
|
||||
/** An element backed by a class, class-like, or function value */
|
||||
ValueElement = 1 << 2,
|
||||
/** Element resolution failed */
|
||||
UnknownElement = 1 << 4,
|
||||
|
||||
IntrinsicElement = IntrinsicNamedElement | IntrinsicIndexedElement
|
||||
IntrinsicElement = IntrinsicNamedElement | IntrinsicIndexedElement,
|
||||
}
|
||||
|
||||
|
||||
@@ -1753,7 +1757,7 @@ namespace ts {
|
||||
export interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void;
|
||||
buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): void;
|
||||
buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void;
|
||||
|
||||
@@ -1896,8 +1896,10 @@ namespace ts {
|
||||
* Resolves a local path to a path which is absolute to the base of the emit
|
||||
*/
|
||||
export function getExternalModuleNameFromPath(host: EmitHost, fileName: string): string {
|
||||
const dir = toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), f => host.getCanonicalFileName(f));
|
||||
const relativePath = getRelativePathToDirectoryOrUrl(dir, fileName, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/ false);
|
||||
const getCanonicalFileName = (f: string) => host.getCanonicalFileName(f);
|
||||
const dir = toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), getCanonicalFileName);
|
||||
const filePath = getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
|
||||
const relativePath = getRelativePathToDirectoryOrUrl(dir, filePath, dir, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
|
||||
return removeFileExtension(relativePath);
|
||||
}
|
||||
|
||||
@@ -2405,7 +2407,7 @@ namespace ts {
|
||||
* Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph
|
||||
* as the fallback implementation does not check for circular references by default.
|
||||
*/
|
||||
export const stringify: (value: any) => string = JSON && JSON.stringify
|
||||
export const stringify: (value: any) => string = typeof JSON !== "undefined" && JSON.stringify
|
||||
? JSON.stringify
|
||||
: stringifyFallback;
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
|
||||
it("Correct JS output for " + fileName, () => {
|
||||
if (hasNonDtsFiles && this.emit) {
|
||||
if (result.files.length === 0 && result.errors.length === 0) {
|
||||
if (!options.noEmit && result.files.length === 0 && result.errors.length === 0) {
|
||||
throw new Error("Expected at least one js file to be emitted or at least one error to be created.");
|
||||
}
|
||||
|
||||
|
||||
+12
-4
@@ -908,6 +908,7 @@ namespace Harness {
|
||||
useCaseSensitiveFileNames?: boolean;
|
||||
includeBuiltFile?: string;
|
||||
baselineFile?: string;
|
||||
libFiles?: string;
|
||||
}
|
||||
|
||||
// Additional options not already in ts.optionDeclarations
|
||||
@@ -917,6 +918,7 @@ namespace Harness {
|
||||
{ name: "baselineFile", type: "string" },
|
||||
{ name: "includeBuiltFile", type: "string" },
|
||||
{ name: "fileName", type: "string" },
|
||||
{ name: "libFiles", type: "string" },
|
||||
{ name: "noErrorTruncation", type: "boolean" }
|
||||
];
|
||||
|
||||
@@ -995,14 +997,11 @@ namespace Harness {
|
||||
currentDirectory = currentDirectory || Harness.IO.getCurrentDirectory();
|
||||
|
||||
// Parse settings
|
||||
let useCaseSensitiveFileNames = Harness.IO.useCaseSensitiveFileNames();
|
||||
if (harnessSettings) {
|
||||
setCompilerOptionsFromHarnessSetting(harnessSettings, options);
|
||||
}
|
||||
if (options.useCaseSensitiveFileNames !== undefined) {
|
||||
useCaseSensitiveFileNames = options.useCaseSensitiveFileNames;
|
||||
}
|
||||
|
||||
const useCaseSensitiveFileNames = options.useCaseSensitiveFileNames !== undefined ? options.useCaseSensitiveFileNames : Harness.IO.useCaseSensitiveFileNames();
|
||||
const programFiles: TestFile[] = inputFiles.slice();
|
||||
// Files from built\local that are requested by test "@includeBuiltFiles" to be in the context.
|
||||
// Treat them as library files, so include them in build, but not in baselines.
|
||||
@@ -1017,6 +1016,15 @@ namespace Harness {
|
||||
|
||||
const fileOutputs: GeneratedFile[] = [];
|
||||
|
||||
// Files from tests\lib that are requested by "@libFiles"
|
||||
if (options.libFiles) {
|
||||
for (const fileName of options.libFiles.split(",")) {
|
||||
const libFileName = "tests/lib/" + fileName;
|
||||
programFiles.push({ unitName: libFileName, content: normalizeLineEndings(IO.readFile(libFileName), Harness.IO.newLine()) });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const programFileNames = programFiles.map(file => file.unitName);
|
||||
|
||||
const compilerHost = createCompilerHost(
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
//// [tests/cases/conformance/es6/moduleExportsAmd/anonymousDefaultExportsAmd.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
export default class {}
|
||||
|
||||
//// [b.ts]
|
||||
export default function() {}
|
||||
|
||||
//// [a.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
class default_1 {
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
});
|
||||
//// [b.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
function default_1() { }
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/a.ts ===
|
||||
export default class {}
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/conformance/es6/moduleExportsAmd/b.ts ===
|
||||
export default function() {}
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/a.ts ===
|
||||
export default class {}
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/conformance/es6/moduleExportsAmd/b.ts ===
|
||||
export default function() {}
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,19 @@
|
||||
//// [tests/cases/conformance/es6/moduleExportsCommonjs/anonymousDefaultExportsCommonjs.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
export default class {}
|
||||
|
||||
//// [b.ts]
|
||||
export default function() {}
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
class default_1 {
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
//// [b.js]
|
||||
"use strict";
|
||||
function default_1() { }
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/a.ts ===
|
||||
export default class {}
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/conformance/es6/moduleExportsCommonjs/b.ts ===
|
||||
export default function() {}
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/a.ts ===
|
||||
export default class {}
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/conformance/es6/moduleExportsCommonjs/b.ts ===
|
||||
export default function() {}
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,32 @@
|
||||
//// [tests/cases/conformance/es6/moduleExportsSystem/anonymousDefaultExportsSystem.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
export default class {}
|
||||
|
||||
//// [b.ts]
|
||||
export default function() {}
|
||||
|
||||
//// [a.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
var default_1;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
class default_1 {
|
||||
}
|
||||
exports_1("default", default_1);
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [b.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
function default_1() { }
|
||||
exports_1("default", default_1);
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/a.ts ===
|
||||
export default class {}
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/conformance/es6/moduleExportsSystem/b.ts ===
|
||||
export default function() {}
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/a.ts ===
|
||||
export default class {}
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/conformance/es6/moduleExportsSystem/b.ts ===
|
||||
export default function() {}
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,37 @@
|
||||
//// [tests/cases/conformance/es6/moduleExportsUmd/anonymousDefaultExportsUmd.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
export default class {}
|
||||
|
||||
//// [b.ts]
|
||||
export default function() {}
|
||||
|
||||
//// [a.js]
|
||||
(function (factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === 'function' && define.amd) {
|
||||
define(["require", "exports"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
class default_1 {
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
});
|
||||
//// [b.js]
|
||||
(function (factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === 'function' && define.amd) {
|
||||
define(["require", "exports"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
function default_1() { }
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/a.ts ===
|
||||
export default class {}
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/conformance/es6/moduleExportsUmd/b.ts ===
|
||||
export default function() {}
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/a.ts ===
|
||||
export default class {}
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/conformance/es6/moduleExportsUmd/b.ts ===
|
||||
export default function() {}
|
||||
No type information for this code.
|
||||
@@ -1,11 +1,19 @@
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(28,1): error TS2322: Type 'S2' is not assignable to type 'T'.
|
||||
Type 'S2' provides no match for the signature 'new (x: number): void'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(29,1): error TS2322: Type '(x: string) => void' is not assignable to type 'T'.
|
||||
Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(30,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'.
|
||||
Type '(x: string) => number' provides no match for the signature 'new (x: number): void'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(31,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'.
|
||||
Type '(x: string) => string' provides no match for the signature 'new (x: number): void'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(32,1): error TS2322: Type 'S2' is not assignable to type 'new (x: number) => void'.
|
||||
Type 'S2' provides no match for the signature 'new (x: number): void'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(33,1): error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
|
||||
Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(34,1): error TS2322: Type '(x: string) => number' is not assignable to type 'new (x: number) => void'.
|
||||
Type '(x: string) => number' provides no match for the signature 'new (x: number): void'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts(35,1): error TS2322: Type '(x: string) => string' is not assignable to type 'new (x: number) => void'.
|
||||
Type '(x: string) => string' provides no match for the signature 'new (x: number): void'
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts (8 errors) ====
|
||||
@@ -39,25 +47,33 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
t = s2;
|
||||
~
|
||||
!!! error TS2322: Type 'S2' is not assignable to type 'T'.
|
||||
!!! error TS2322: Type 'S2' provides no match for the signature 'new (x: number): void'
|
||||
t = a3;
|
||||
~
|
||||
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'T'.
|
||||
!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
|
||||
t = (x: string) => 1;
|
||||
~
|
||||
!!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'.
|
||||
!!! error TS2322: Type '(x: string) => number' provides no match for the signature 'new (x: number): void'
|
||||
t = function (x: string) { return ''; }
|
||||
~
|
||||
!!! error TS2322: Type '(x: string) => string' is not assignable to type 'T'.
|
||||
!!! error TS2322: Type '(x: string) => string' provides no match for the signature 'new (x: number): void'
|
||||
a = s2;
|
||||
~
|
||||
!!! error TS2322: Type 'S2' is not assignable to type 'new (x: number) => void'.
|
||||
!!! error TS2322: Type 'S2' provides no match for the signature 'new (x: number): void'
|
||||
a = a3;
|
||||
~
|
||||
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
|
||||
!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
|
||||
a = (x: string) => 1;
|
||||
~
|
||||
!!! error TS2322: Type '(x: string) => number' is not assignable to type 'new (x: number) => void'.
|
||||
!!! error TS2322: Type '(x: string) => number' provides no match for the signature 'new (x: number): void'
|
||||
a = function (x: string) { return ''; }
|
||||
~
|
||||
!!! error TS2322: Type '(x: string) => string' is not assignable to type 'new (x: number) => void'.
|
||||
!!! error TS2322: Type '(x: string) => string' provides no match for the signature 'new (x: number): void'
|
||||
|
||||
@@ -9,9 +9,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(34,1): error TS2322: Type 'S2' is not assignable to type 'T'.
|
||||
Types of property 'f' are incompatible.
|
||||
Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
|
||||
Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(35,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T'.
|
||||
Types of property 'f' are incompatible.
|
||||
Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
|
||||
Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(36,1): error TS2322: Type '(x: string) => number' is not assignable to type 'T'.
|
||||
Property 'f' is missing in type '(x: string) => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(37,1): error TS2322: Type '(x: string) => string' is not assignable to type 'T'.
|
||||
@@ -19,9 +21,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(38,1): error TS2322: Type 'S2' is not assignable to type '{ f: new (x: number) => void; }'.
|
||||
Types of property 'f' are incompatible.
|
||||
Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
|
||||
Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(39,1): error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f: new (x: number) => void; }'.
|
||||
Types of property 'f' are incompatible.
|
||||
Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
|
||||
Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(40,1): error TS2322: Type '(x: string) => number' is not assignable to type '{ f: new (x: number) => void; }'.
|
||||
Property 'f' is missing in type '(x: string) => number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures2.ts(41,1): error TS2322: Type '(x: string) => string' is not assignable to type '{ f: new (x: number) => void; }'.
|
||||
@@ -79,11 +83,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
!!! error TS2322: Type 'S2' is not assignable to type 'T'.
|
||||
!!! error TS2322: Types of property 'f' are incompatible.
|
||||
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
|
||||
!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
|
||||
t = a3;
|
||||
~
|
||||
!!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type 'T'.
|
||||
!!! error TS2322: Types of property 'f' are incompatible.
|
||||
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
|
||||
!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
|
||||
t = (x: string) => 1;
|
||||
~
|
||||
!!! error TS2322: Type '(x: string) => number' is not assignable to type 'T'.
|
||||
@@ -97,11 +103,13 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
!!! error TS2322: Type 'S2' is not assignable to type '{ f: new (x: number) => void; }'.
|
||||
!!! error TS2322: Types of property 'f' are incompatible.
|
||||
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
|
||||
!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
|
||||
a = a3;
|
||||
~
|
||||
!!! error TS2322: Type '{ f(x: string): void; }' is not assignable to type '{ f: new (x: number) => void; }'.
|
||||
!!! error TS2322: Types of property 'f' are incompatible.
|
||||
!!! error TS2322: Type '(x: string) => void' is not assignable to type 'new (x: number) => void'.
|
||||
!!! error TS2322: Type '(x: string) => void' provides no match for the signature 'new (x: number): void'
|
||||
a = (x: string) => 1;
|
||||
~
|
||||
!!! error TS2322: Type '(x: string) => number' is not assignable to type '{ f: new (x: number) => void; }'.
|
||||
|
||||
@@ -11,12 +11,14 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(77,9): error TS2322: Type 'new <T>(x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'.
|
||||
Type '(a: any) => any' provides no match for the signature 'new (a: number): number'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(78,9): error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => T[]'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(81,9): error TS2322: Type 'new <T>(x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }): any[]; new (x: { new <T extends Derived2>(a: T): T; new <T extends Base>(a: T): T; }): any[]; }'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '(a: any) => any' is not assignable to type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }'.
|
||||
Type '(a: any) => any' provides no match for the signature 'new <T extends Derived>(a: T): T'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(82,9): error TS2322: Type '{ new (x: { new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }): any[]; new (x: { new <T extends Derived2>(a: T): T; new <T extends Base>(a: T): T; }): any[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => any[]'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }' is not assignable to type '(a: any) => any'.
|
||||
@@ -116,6 +118,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
!!! error TS2322: Type 'new <T>(x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }'.
|
||||
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'.
|
||||
!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new (a: number): number'
|
||||
b16 = a16; // error
|
||||
~~~
|
||||
!!! error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => T[]'.
|
||||
@@ -128,6 +131,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
!!! error TS2322: Type 'new <T>(x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }): any[]; new (x: { new <T extends Derived2>(a: T): T; new <T extends Base>(a: T): T; }): any[]; }'.
|
||||
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2322: Type '(a: any) => any' is not assignable to type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }'.
|
||||
!!! error TS2322: Type '(a: any) => any' provides no match for the signature 'new <T extends Derived>(a: T): T'
|
||||
b17 = a17; // error
|
||||
~~~
|
||||
!!! error TS2322: Type '{ new (x: { new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }): any[]; new (x: { new <T extends Derived2>(a: T): T; new <T extends Base>(a: T): T; }): any[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => any[]'.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
tests/cases/compiler/assignmentCompatability24.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tstring>(a: Tstring) => Tstring'.
|
||||
Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature '<Tstring>(a: Tstring): Tstring'
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability24.ts (1 errors) ====
|
||||
@@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability24.ts(9,1): error TS2322: Type 'inte
|
||||
}
|
||||
__test2__.__val__obj = __test1__.__val__obj4
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tstring>(a: Tstring) => Tstring'.
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tstring>(a: Tstring) => Tstring'.
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature '<Tstring>(a: Tstring): Tstring'
|
||||
@@ -1,4 +1,5 @@
|
||||
tests/cases/compiler/assignmentCompatability33.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tstring>(a: Tstring) => Tstring'.
|
||||
Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature '<Tstring>(a: Tstring): Tstring'
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability33.ts (1 errors) ====
|
||||
@@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability33.ts(9,1): error TS2322: Type 'inte
|
||||
}
|
||||
__test2__.__val__obj = __test1__.__val__obj4
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tstring>(a: Tstring) => Tstring'.
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tstring>(a: Tstring) => Tstring'.
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature '<Tstring>(a: Tstring): Tstring'
|
||||
@@ -1,4 +1,5 @@
|
||||
tests/cases/compiler/assignmentCompatability34.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tnumber>(a: Tnumber) => Tnumber'.
|
||||
Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature '<Tnumber>(a: Tnumber): Tnumber'
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability34.ts (1 errors) ====
|
||||
@@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability34.ts(9,1): error TS2322: Type 'inte
|
||||
}
|
||||
__test2__.__val__obj = __test1__.__val__obj4
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tnumber>(a: Tnumber) => Tnumber'.
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '<Tnumber>(a: Tnumber) => Tnumber'.
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature '<Tnumber>(a: Tnumber): Tnumber'
|
||||
@@ -1,4 +1,5 @@
|
||||
tests/cases/compiler/assignmentCompatability37.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'new <Tnumber>(param: Tnumber) => any'.
|
||||
Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature 'new <Tnumber>(param: Tnumber): any'
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability37.ts (1 errors) ====
|
||||
@@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability37.ts(9,1): error TS2322: Type 'inte
|
||||
}
|
||||
__test2__.__val__aa = __test1__.__val__obj4
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'new <Tnumber>(param: Tnumber) => any'.
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'new <Tnumber>(param: Tnumber) => any'.
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature 'new <Tnumber>(param: Tnumber): any'
|
||||
@@ -1,4 +1,5 @@
|
||||
tests/cases/compiler/assignmentCompatability38.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'new <Tstring>(param: Tstring) => any'.
|
||||
Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature 'new <Tstring>(param: Tstring): any'
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability38.ts (1 errors) ====
|
||||
@@ -12,4 +13,5 @@ tests/cases/compiler/assignmentCompatability38.ts(9,1): error TS2322: Type 'inte
|
||||
}
|
||||
__test2__.__val__aa = __test1__.__val__obj4
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'new <Tstring>(param: Tstring) => any'.
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type 'new <Tstring>(param: Tstring) => any'.
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' provides no match for the signature 'new <Tstring>(param: Tstring): any'
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/async/es6/asyncAliasReturnType_es6.ts(3,16): error TS1055: Type 'PromiseAlias' is not a valid async function return type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncAliasReturnType_es6.ts (1 errors) ====
|
||||
type PromiseAlias<T> = Promise<T>;
|
||||
|
||||
async function f(): PromiseAlias<void> {
|
||||
~
|
||||
!!! error TS1055: Type 'PromiseAlias' is not a valid async function return type.
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [asyncAliasReturnType_es6.ts]
|
||||
type PromiseAlias<T> = Promise<T>;
|
||||
|
||||
async function f(): PromiseAlias<void> {
|
||||
}
|
||||
|
||||
//// [asyncAliasReturnType_es6.js]
|
||||
function f() {
|
||||
return __awaiter(this, void 0, PromiseAlias, function* () {
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//// [tests/cases/conformance/async/es6/asyncImportedPromise_es6.ts] ////
|
||||
|
||||
//// [task.ts]
|
||||
export class Task<T> extends Promise<T> { }
|
||||
|
||||
//// [test.ts]
|
||||
import { Task } from "./task";
|
||||
class Test {
|
||||
async example<T>(): Task<T> { return; }
|
||||
}
|
||||
|
||||
//// [task.js]
|
||||
"use strict";
|
||||
class Task extends Promise {
|
||||
}
|
||||
exports.Task = Task;
|
||||
//// [test.js]
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
generator = generator.call(thisArg, _arguments);
|
||||
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
|
||||
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
|
||||
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
|
||||
function step(verb, value) {
|
||||
var result = generator[verb](value);
|
||||
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
|
||||
}
|
||||
step("next", void 0);
|
||||
});
|
||||
};
|
||||
var task_1 = require("./task");
|
||||
class Test {
|
||||
example() {
|
||||
return __awaiter(this, void 0, task_1.Task, function* () { return; });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/async/es6/task.ts ===
|
||||
export class Task<T> extends Promise<T> { }
|
||||
>Task : Symbol(Task, Decl(task.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(task.ts, 0, 18))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(task.ts, 0, 18))
|
||||
|
||||
=== tests/cases/conformance/async/es6/test.ts ===
|
||||
import { Task } from "./task";
|
||||
>Task : Symbol(Task, Decl(test.ts, 0, 8))
|
||||
|
||||
class Test {
|
||||
>Test : Symbol(Test, Decl(test.ts, 0, 30))
|
||||
|
||||
async example<T>(): Task<T> { return; }
|
||||
>example : Symbol(example, Decl(test.ts, 1, 12))
|
||||
>T : Symbol(T, Decl(test.ts, 2, 18))
|
||||
>Task : Symbol(Task, Decl(test.ts, 0, 8))
|
||||
>T : Symbol(T, Decl(test.ts, 2, 18))
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/async/es6/task.ts ===
|
||||
export class Task<T> extends Promise<T> { }
|
||||
>Task : Task<T>
|
||||
>T : T
|
||||
>Promise : Promise<T>
|
||||
>T : T
|
||||
|
||||
=== tests/cases/conformance/async/es6/test.ts ===
|
||||
import { Task } from "./task";
|
||||
>Task : typeof Task
|
||||
|
||||
class Test {
|
||||
>Test : Test
|
||||
|
||||
async example<T>(): Task<T> { return; }
|
||||
>example : <T>() => Task<T>
|
||||
>T : T
|
||||
>Task : Task<T>
|
||||
>T : T
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
//// [asyncQualifiedReturnType_es6.ts]
|
||||
namespace X {
|
||||
export class MyPromise<T> extends Promise<T> {
|
||||
}
|
||||
}
|
||||
|
||||
async function f(): X.MyPromise<void> {
|
||||
}
|
||||
|
||||
//// [asyncQualifiedReturnType_es6.js]
|
||||
var X;
|
||||
(function (X) {
|
||||
class MyPromise extends Promise {
|
||||
}
|
||||
X.MyPromise = MyPromise;
|
||||
})(X || (X = {}));
|
||||
function f() {
|
||||
return __awaiter(this, void 0, X.MyPromise, function* () {
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/conformance/async/es6/asyncQualifiedReturnType_es6.ts ===
|
||||
namespace X {
|
||||
>X : Symbol(X, Decl(asyncQualifiedReturnType_es6.ts, 0, 0))
|
||||
|
||||
export class MyPromise<T> extends Promise<T> {
|
||||
>MyPromise : Symbol(MyPromise, Decl(asyncQualifiedReturnType_es6.ts, 0, 13))
|
||||
>T : Symbol(T, Decl(asyncQualifiedReturnType_es6.ts, 1, 27))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(asyncQualifiedReturnType_es6.ts, 1, 27))
|
||||
}
|
||||
}
|
||||
|
||||
async function f(): X.MyPromise<void> {
|
||||
>f : Symbol(f, Decl(asyncQualifiedReturnType_es6.ts, 3, 1))
|
||||
>X : Symbol(X, Decl(asyncQualifiedReturnType_es6.ts, 0, 0))
|
||||
>MyPromise : Symbol(X.MyPromise, Decl(asyncQualifiedReturnType_es6.ts, 0, 13))
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/conformance/async/es6/asyncQualifiedReturnType_es6.ts ===
|
||||
namespace X {
|
||||
>X : typeof X
|
||||
|
||||
export class MyPromise<T> extends Promise<T> {
|
||||
>MyPromise : MyPromise<T>
|
||||
>T : T
|
||||
>Promise : Promise<T>
|
||||
>T : T
|
||||
}
|
||||
}
|
||||
|
||||
async function f(): X.MyPromise<void> {
|
||||
>f : () => X.MyPromise<void>
|
||||
>X : any
|
||||
>MyPromise : X.MyPromise<T>
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
tests/cases/compiler/callConstructAssignment.ts(7,1): error TS2322: Type 'new () => any' is not assignable to type '() => void'.
|
||||
Type 'new () => any' provides no match for the signature '(): void'
|
||||
tests/cases/compiler/callConstructAssignment.ts(8,1): error TS2322: Type '() => void' is not assignable to type 'new () => any'.
|
||||
Type '() => void' provides no match for the signature 'new (): any'
|
||||
|
||||
|
||||
==== tests/cases/compiler/callConstructAssignment.ts (2 errors) ====
|
||||
@@ -12,6 +14,8 @@ tests/cases/compiler/callConstructAssignment.ts(8,1): error TS2322: Type '() =>
|
||||
foo = bar; // error
|
||||
~~~
|
||||
!!! error TS2322: Type 'new () => any' is not assignable to type '() => void'.
|
||||
!!! error TS2322: Type 'new () => any' provides no match for the signature '(): void'
|
||||
bar = foo; // error
|
||||
~~~
|
||||
!!! error TS2322: Type '() => void' is not assignable to type 'new () => any'.
|
||||
!!! error TS2322: Type '() => void' is not assignable to type 'new () => any'.
|
||||
!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any'
|
||||
@@ -16,17 +16,17 @@ export var pi = Math.PI;
|
||||
export var y = x * i;
|
||||
|
||||
//// [concat.js]
|
||||
define("tests/cases/compiler/baz", ["require", "exports", "tests/cases/compiler/a/bar", "tests/cases/compiler/a/foo"], function (require, exports, bar_1, foo_1) {
|
||||
define("baz", ["require", "exports", "a/bar", "a/foo"], function (require, exports, bar_1, foo_1) {
|
||||
"use strict";
|
||||
exports.pi = Math.PI;
|
||||
exports.y = bar_1.x * foo_1.i;
|
||||
});
|
||||
define("tests/cases/compiler/a/foo", ["require", "exports", "tests/cases/compiler/baz"], function (require, exports, baz_1) {
|
||||
define("a/foo", ["require", "exports", "baz"], function (require, exports, baz_1) {
|
||||
"use strict";
|
||||
exports.i = Math.sqrt(-1);
|
||||
exports.z = baz_1.pi * baz_1.pi;
|
||||
});
|
||||
define("tests/cases/compiler/a/bar", ["require", "exports", "tests/cases/compiler/a/foo"], function (require, exports, foo_2) {
|
||||
define("a/bar", ["require", "exports", "a/foo"], function (require, exports, foo_2) {
|
||||
"use strict";
|
||||
exports.x = foo_2.z + foo_2.z;
|
||||
});
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
tests/cases/compiler/constructorAsType.ts(1,5): error TS2322: Type '() => { name: string; }' is not assignable to type 'new () => { name: string; }'.
|
||||
Type '() => { name: string; }' provides no match for the signature 'new (): { name: string; }'
|
||||
|
||||
|
||||
==== tests/cases/compiler/constructorAsType.ts (1 errors) ====
|
||||
var Person:new () => {name: string;} = function () {return {name:"joe"};};
|
||||
~~~~~~
|
||||
!!! error TS2322: Type '() => { name: string; }' is not assignable to type 'new () => { name: string; }'.
|
||||
!!! error TS2322: Type '() => { name: string; }' provides no match for the signature 'new (): { name: string; }'
|
||||
|
||||
var Person2:{new() : {name:string;};};
|
||||
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
//// [decoratedDefaultExportsGetExportedAmd.ts]
|
||||
|
||||
//// [tests/cases/conformance/es6/moduleExportsAmd/decoratedDefaultExportsGetExportedAmd.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
var decorator: ClassDecorator;
|
||||
|
||||
@decorator
|
||||
export default class Foo {}
|
||||
|
||||
//// [b.ts]
|
||||
var decorator: ClassDecorator;
|
||||
|
||||
@decorator
|
||||
export default class {}
|
||||
|
||||
//// [decoratedDefaultExportsGetExportedAmd.js]
|
||||
|
||||
//// [a.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
@@ -21,5 +28,24 @@ define(["require", "exports"], function (require, exports) {
|
||||
Foo = __decorate([
|
||||
decorator
|
||||
], Foo);
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Foo;
|
||||
});
|
||||
//// [b.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var decorator;
|
||||
let default_1 = class {
|
||||
};
|
||||
default_1 = __decorate([
|
||||
decorator
|
||||
], default_1);
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
});
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/decoratedDefaultExportsGetExportedAmd.ts ===
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/a.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedAmd.ts, 1, 3))
|
||||
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
|
||||
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedAmd.ts, 1, 3))
|
||||
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(decoratedDefaultExportsGetExportedAmd.ts, 1, 30))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 30))
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/b.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
|
||||
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
|
||||
|
||||
export default class {}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/decoratedDefaultExportsGetExportedAmd.ts ===
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/a.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
@@ -10,3 +9,13 @@ var decorator: ClassDecorator;
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/b.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
export default class {}
|
||||
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
//// [decoratedDefaultExportsGetExportedCommonjs.ts]
|
||||
|
||||
//// [tests/cases/conformance/es6/moduleExportsCommonjs/decoratedDefaultExportsGetExportedCommonjs.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
var decorator: ClassDecorator;
|
||||
|
||||
@decorator
|
||||
export default class Foo {}
|
||||
|
||||
//// [b.ts]
|
||||
var decorator: ClassDecorator;
|
||||
|
||||
@decorator
|
||||
export default class {}
|
||||
|
||||
//// [decoratedDefaultExportsGetExportedCommonjs.js]
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
@@ -20,4 +27,21 @@ let Foo = class {
|
||||
Foo = __decorate([
|
||||
decorator
|
||||
], Foo);
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Foo;
|
||||
//// [b.js]
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var decorator;
|
||||
let default_1 = class {
|
||||
};
|
||||
default_1 = __decorate([
|
||||
decorator
|
||||
], default_1);
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/decoratedDefaultExportsGetExportedCommonjs.ts ===
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/a.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedCommonjs.ts, 1, 3))
|
||||
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
|
||||
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedCommonjs.ts, 1, 3))
|
||||
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(decoratedDefaultExportsGetExportedCommonjs.ts, 1, 30))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 30))
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/b.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
|
||||
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
|
||||
|
||||
export default class {}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/decoratedDefaultExportsGetExportedCommonjs.ts ===
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/a.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
@@ -10,3 +9,13 @@ var decorator: ClassDecorator;
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/b.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
export default class {}
|
||||
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
//// [decoratedDefaultExportsGetExportedSystem.ts]
|
||||
|
||||
//// [tests/cases/conformance/es6/moduleExportsSystem/decoratedDefaultExportsGetExportedSystem.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
var decorator: ClassDecorator;
|
||||
|
||||
@decorator
|
||||
export default class Foo {}
|
||||
|
||||
//// [b.ts]
|
||||
var decorator: ClassDecorator;
|
||||
|
||||
@decorator
|
||||
export default class {}
|
||||
|
||||
//// [decoratedDefaultExportsGetExportedSystem.js]
|
||||
//// [a.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
@@ -28,3 +34,25 @@ System.register([], function(exports_1) {
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [b.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var decorator, default_1;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
let default_1 = class {
|
||||
};
|
||||
default_1 = __decorate([
|
||||
decorator
|
||||
], default_1);
|
||||
exports_1("default", default_1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/decoratedDefaultExportsGetExportedSystem.ts ===
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/a.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedSystem.ts, 1, 3))
|
||||
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
|
||||
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedSystem.ts, 1, 3))
|
||||
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(decoratedDefaultExportsGetExportedSystem.ts, 1, 30))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 30))
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/b.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
|
||||
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
|
||||
|
||||
export default class {}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/decoratedDefaultExportsGetExportedSystem.ts ===
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/a.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
@@ -10,3 +9,12 @@ var decorator: ClassDecorator;
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/b.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
export default class {}
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
//// [decoratedDefaultExportsGetExportedUmd.ts]
|
||||
|
||||
//// [tests/cases/conformance/es6/moduleExportsUmd/decoratedDefaultExportsGetExportedUmd.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
var decorator: ClassDecorator;
|
||||
|
||||
@decorator
|
||||
export default class Foo {}
|
||||
|
||||
//// [b.ts]
|
||||
var decorator: ClassDecorator;
|
||||
|
||||
@decorator
|
||||
export default class {}
|
||||
|
||||
//// [decoratedDefaultExportsGetExportedUmd.js]
|
||||
|
||||
//// [a.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
@@ -28,5 +35,31 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||
Foo = __decorate([
|
||||
decorator
|
||||
], Foo);
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Foo;
|
||||
});
|
||||
//// [b.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
(function (factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === 'function' && define.amd) {
|
||||
define(["require", "exports"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
var decorator;
|
||||
let default_1 = class {
|
||||
};
|
||||
default_1 = __decorate([
|
||||
decorator
|
||||
], default_1);
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
});
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/decoratedDefaultExportsGetExportedUmd.ts ===
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/a.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedUmd.ts, 1, 3))
|
||||
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
|
||||
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedUmd.ts, 1, 3))
|
||||
>decorator : Symbol(decorator, Decl(a.ts, 0, 3))
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(decoratedDefaultExportsGetExportedUmd.ts, 1, 30))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 30))
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/b.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
|
||||
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(b.ts, 0, 3))
|
||||
|
||||
export default class {}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/decoratedDefaultExportsGetExportedUmd.ts ===
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/a.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
@@ -10,3 +9,13 @@ var decorator: ClassDecorator;
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/b.ts ===
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
export default class {}
|
||||
|
||||
|
||||
@@ -1,11 +1,24 @@
|
||||
//// [defaultExportsGetExportedAmd.ts]
|
||||
//// [tests/cases/conformance/es6/moduleExportsAmd/defaultExportsGetExportedAmd.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
export default class Foo {}
|
||||
|
||||
//// [b.ts]
|
||||
export default function foo() {}
|
||||
|
||||
//// [defaultExportsGetExportedAmd.js]
|
||||
|
||||
//// [a.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
class Foo {
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Foo;
|
||||
});
|
||||
//// [b.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
function foo() { }
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = foo;
|
||||
});
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/defaultExportsGetExportedAmd.ts ===
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/a.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(defaultExportsGetExportedAmd.ts, 0, 0))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 0))
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/b.ts ===
|
||||
export default function foo() {}
|
||||
>foo : Symbol(foo, Decl(b.ts, 0, 0))
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/defaultExportsGetExportedAmd.ts ===
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/a.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/b.ts ===
|
||||
export default function foo() {}
|
||||
>foo : () => void
|
||||
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
//// [defaultExportsGetExportedCommonjs.ts]
|
||||
//// [tests/cases/conformance/es6/moduleExportsCommonjs/defaultExportsGetExportedCommonjs.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
export default class Foo {}
|
||||
|
||||
//// [b.ts]
|
||||
export default function foo() {}
|
||||
|
||||
//// [defaultExportsGetExportedCommonjs.js]
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
class Foo {
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Foo;
|
||||
//// [b.js]
|
||||
"use strict";
|
||||
function foo() { }
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = foo;
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/defaultExportsGetExportedCommonjs.ts ===
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/a.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(defaultExportsGetExportedCommonjs.ts, 0, 0))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 0))
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/b.ts ===
|
||||
export default function foo() {}
|
||||
>foo : Symbol(foo, Decl(b.ts, 0, 0))
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/defaultExportsGetExportedCommonjs.ts ===
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/a.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsCommonjs/b.ts ===
|
||||
export default function foo() {}
|
||||
>foo : () => void
|
||||
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
//// [defaultExportsGetExportedSystem.ts]
|
||||
//// [tests/cases/conformance/es6/moduleExportsSystem/defaultExportsGetExportedSystem.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
export default class Foo {}
|
||||
|
||||
//// [b.ts]
|
||||
export default function foo() {}
|
||||
|
||||
//// [defaultExportsGetExportedSystem.js]
|
||||
|
||||
//// [a.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
var Foo;
|
||||
@@ -15,3 +20,14 @@ System.register([], function(exports_1) {
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [b.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
function foo() { }
|
||||
exports_1("default", foo);
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/defaultExportsGetExportedSystem.ts ===
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/a.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(defaultExportsGetExportedSystem.ts, 0, 0))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 0))
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/b.ts ===
|
||||
export default function foo() {}
|
||||
>foo : Symbol(foo, Decl(b.ts, 0, 0))
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/defaultExportsGetExportedSystem.ts ===
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/a.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/b.ts ===
|
||||
export default function foo() {}
|
||||
>foo : () => void
|
||||
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
//// [defaultExportsGetExportedUmd.ts]
|
||||
//// [tests/cases/conformance/es6/moduleExportsUmd/defaultExportsGetExportedUmd.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
export default class Foo {}
|
||||
|
||||
//// [b.ts]
|
||||
export default function foo() {}
|
||||
|
||||
//// [defaultExportsGetExportedUmd.js]
|
||||
|
||||
//// [a.js]
|
||||
(function (factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
@@ -14,5 +19,20 @@ export default class Foo {}
|
||||
"use strict";
|
||||
class Foo {
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Foo;
|
||||
});
|
||||
//// [b.js]
|
||||
(function (factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === 'function' && define.amd) {
|
||||
define(["require", "exports"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
function foo() { }
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = foo;
|
||||
});
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/defaultExportsGetExportedUmd.ts ===
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/a.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(defaultExportsGetExportedUmd.ts, 0, 0))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 0))
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/b.ts ===
|
||||
export default function foo() {}
|
||||
>foo : Symbol(foo, Decl(b.ts, 0, 0))
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/defaultExportsGetExportedUmd.ts ===
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/a.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsUmd/b.ts ===
|
||||
export default function foo() {}
|
||||
>foo : () => void
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ var x1: number = m;
|
||||
exports.a = 10;
|
||||
exports.x = exports.a;
|
||||
exports.m = exports.a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = {};
|
||||
//// [es6ImportDefaultBindingFollowedWithNamedImport_1.js]
|
||||
"use strict";
|
||||
|
||||
@@ -41,6 +41,7 @@ export { a, b, c, d, e1, e2, f1, f2 };
|
||||
|
||||
//// [t1.js]
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = "hello";
|
||||
//// [t3.js]
|
||||
"use strict";
|
||||
|
||||
@@ -10,7 +10,7 @@ function foo() {
|
||||
|
||||
|
||||
//// [a.js]
|
||||
define("tests/cases/compiler/a", ["require", "exports"], function (require, exports) {
|
||||
define("a", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var c = (function () {
|
||||
function c() {
|
||||
|
||||
@@ -3,15 +3,21 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(6,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(23,14): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'.
|
||||
Type 'Function' provides no match for the signature '(x: string): string'
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(24,15): error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type 'string[]' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(25,15): error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'.
|
||||
Type 'typeof C' provides no match for the signature '(x: string): string'
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(26,15): error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
|
||||
Type 'new (x: string) => string' provides no match for the signature '(x: string): string'
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(28,16): error TS2345: Argument of type '<U, V>(x: U, y: V) => U' is not assignable to parameter of type '(x: string) => string'.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(29,16): error TS2345: Argument of type 'typeof C2' is not assignable to parameter of type '(x: string) => string'.
|
||||
Type 'typeof C2' provides no match for the signature '(x: string): string'
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(30,16): error TS2345: Argument of type 'new <T>(x: T) => T' is not assignable to parameter of type '(x: string) => string'.
|
||||
Type 'new <T>(x: T) => T' provides no match for the signature '(x: string): string'
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(34,16): error TS2345: Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'.
|
||||
Type 'F2' provides no match for the signature '(x: string): string'
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(36,38): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list.
|
||||
tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(37,10): error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'.
|
||||
Type '() => void' is not assignable to type '(x: string) => string'.
|
||||
@@ -51,6 +57,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
|
||||
var r = foo2(new Function());
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'.
|
||||
!!! error TS2345: Type 'Function' provides no match for the signature '(x: string): string'
|
||||
var r2 = foo2((x: string[]) => x);
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'.
|
||||
@@ -59,9 +66,11 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
|
||||
var r6 = foo2(C);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'.
|
||||
!!! error TS2345: Type 'typeof C' provides no match for the signature '(x: string): string'
|
||||
var r7 = foo2(b);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'.
|
||||
!!! error TS2345: Type 'new (x: string) => string' provides no match for the signature '(x: string): string'
|
||||
var r8 = foo2(<U>(x: U) => x); // no error expected
|
||||
var r11 = foo2(<U, V>(x: U, y: V) => x);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -69,15 +78,18 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain
|
||||
var r13 = foo2(C2);
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'typeof C2' is not assignable to parameter of type '(x: string) => string'.
|
||||
!!! error TS2345: Type 'typeof C2' provides no match for the signature '(x: string): string'
|
||||
var r14 = foo2(b2);
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'new <T>(x: T) => T' is not assignable to parameter of type '(x: string) => string'.
|
||||
!!! error TS2345: Type 'new <T>(x: T) => T' provides no match for the signature '(x: string): string'
|
||||
|
||||
interface F2 extends Function { foo: string; }
|
||||
var f2: F2;
|
||||
var r16 = foo2(f2);
|
||||
~~
|
||||
!!! error TS2345: Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'.
|
||||
!!! error TS2345: Type 'F2' provides no match for the signature '(x: string): string'
|
||||
|
||||
function fff<T extends { (): void }, U extends T>(x: T, y: U) {
|
||||
~~~~~~~~~~~
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck31.ts(2,11): error TS2322: Type 'IterableIterator<(x: any) => any>' is not assignable to type '() => Iterable<(x: string) => number>'.
|
||||
Type 'IterableIterator<(x: any) => any>' provides no match for the signature '(): Iterable<(x: string) => number>'
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck31.ts (1 errors) ====
|
||||
@@ -10,4 +11,5 @@ tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck31.ts(2,11): erro
|
||||
} ()
|
||||
~~~~~~~~
|
||||
!!! error TS2322: Type 'IterableIterator<(x: any) => any>' is not assignable to type '() => Iterable<(x: string) => number>'.
|
||||
!!! error TS2322: Type 'IterableIterator<(x: any) => any>' provides no match for the signature '(): Iterable<(x: string) => number>'
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
//// [genericSignatureIdentity.ts]
|
||||
// This test is here to remind us of our current limits of type identity checking.
|
||||
// Ideally all of the below declarations would be considered different (and thus errors)
|
||||
// but they aren't because we erase type parameters to type any and don't check that
|
||||
// constraints are identical.
|
||||
|
||||
var x: {
|
||||
<T extends Date>(x: T): T;
|
||||
};
|
||||
|
||||
var x: {
|
||||
<T extends number>(x: T): T;
|
||||
};
|
||||
|
||||
var x: {
|
||||
<T>(x: T): T;
|
||||
};
|
||||
|
||||
var x: {
|
||||
<T>(x: any): any;
|
||||
};
|
||||
|
||||
|
||||
//// [genericSignatureIdentity.js]
|
||||
// This test is here to remind us of our current limits of type identity checking.
|
||||
// Ideally all of the below declarations would be considered different (and thus errors)
|
||||
// but they aren't because we erase type parameters to type any and don't check that
|
||||
// constraints are identical.
|
||||
var x;
|
||||
var x;
|
||||
var x;
|
||||
var x;
|
||||
@@ -0,0 +1,49 @@
|
||||
=== tests/cases/compiler/genericSignatureIdentity.ts ===
|
||||
// This test is here to remind us of our current limits of type identity checking.
|
||||
// Ideally all of the below declarations would be considered different (and thus errors)
|
||||
// but they aren't because we erase type parameters to type any and don't check that
|
||||
// constraints are identical.
|
||||
|
||||
var x: {
|
||||
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 5, 3), Decl(genericSignatureIdentity.ts, 9, 3), Decl(genericSignatureIdentity.ts, 13, 3), Decl(genericSignatureIdentity.ts, 17, 3))
|
||||
|
||||
<T extends Date>(x: T): T;
|
||||
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5))
|
||||
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 6, 21))
|
||||
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5))
|
||||
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5))
|
||||
|
||||
};
|
||||
|
||||
var x: {
|
||||
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 5, 3), Decl(genericSignatureIdentity.ts, 9, 3), Decl(genericSignatureIdentity.ts, 13, 3), Decl(genericSignatureIdentity.ts, 17, 3))
|
||||
|
||||
<T extends number>(x: T): T;
|
||||
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 10, 5))
|
||||
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 10, 23))
|
||||
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 10, 5))
|
||||
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 10, 5))
|
||||
|
||||
};
|
||||
|
||||
var x: {
|
||||
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 5, 3), Decl(genericSignatureIdentity.ts, 9, 3), Decl(genericSignatureIdentity.ts, 13, 3), Decl(genericSignatureIdentity.ts, 17, 3))
|
||||
|
||||
<T>(x: T): T;
|
||||
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 14, 5))
|
||||
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 14, 8))
|
||||
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 14, 5))
|
||||
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 14, 5))
|
||||
|
||||
};
|
||||
|
||||
var x: {
|
||||
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 5, 3), Decl(genericSignatureIdentity.ts, 9, 3), Decl(genericSignatureIdentity.ts, 13, 3), Decl(genericSignatureIdentity.ts, 17, 3))
|
||||
|
||||
<T>(x: any): any;
|
||||
>T : Symbol(T, Decl(genericSignatureIdentity.ts, 18, 5))
|
||||
>x : Symbol(x, Decl(genericSignatureIdentity.ts, 18, 8))
|
||||
|
||||
};
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
=== tests/cases/compiler/genericSignatureIdentity.ts ===
|
||||
// This test is here to remind us of our current limits of type identity checking.
|
||||
// Ideally all of the below declarations would be considered different (and thus errors)
|
||||
// but they aren't because we erase type parameters to type any and don't check that
|
||||
// constraints are identical.
|
||||
|
||||
var x: {
|
||||
>x : <T extends Date>(x: T) => T
|
||||
|
||||
<T extends Date>(x: T): T;
|
||||
>T : T
|
||||
>Date : Date
|
||||
>x : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
};
|
||||
|
||||
var x: {
|
||||
>x : <T extends Date>(x: T) => T
|
||||
|
||||
<T extends number>(x: T): T;
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
};
|
||||
|
||||
var x: {
|
||||
>x : <T extends Date>(x: T) => T
|
||||
|
||||
<T>(x: T): T;
|
||||
>T : T
|
||||
>x : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
};
|
||||
|
||||
var x: {
|
||||
>x : <T extends Date>(x: T) => T
|
||||
|
||||
<T>(x: any): any;
|
||||
>T : T
|
||||
>x : any
|
||||
|
||||
};
|
||||
|
||||
@@ -14,17 +14,24 @@ tests/cases/compiler/intTypeCheck.ts(106,20): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(106,21): error TS2304: Cannot find name 'i1'.
|
||||
tests/cases/compiler/intTypeCheck.ts(107,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(112,5): error TS2322: Type '{}' is not assignable to type 'i2'.
|
||||
Type '{}' provides no match for the signature '(): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(113,5): error TS2322: Type 'Object' is not assignable to type 'i2'.
|
||||
Type 'Object' provides no match for the signature '(): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(114,17): error TS2350: Only a void function can be called with the 'new' keyword.
|
||||
tests/cases/compiler/intTypeCheck.ts(115,5): error TS2322: Type 'Base' is not assignable to type 'i2'.
|
||||
Type 'Base' provides no match for the signature '(): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(120,5): error TS2322: Type 'boolean' is not assignable to type 'i2'.
|
||||
tests/cases/compiler/intTypeCheck.ts(120,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(120,22): error TS2304: Cannot find name 'i2'.
|
||||
tests/cases/compiler/intTypeCheck.ts(121,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(126,5): error TS2322: Type '{}' is not assignable to type 'i3'.
|
||||
Type '{}' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(127,5): error TS2322: Type 'Object' is not assignable to type 'i3'.
|
||||
Type 'Object' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(129,5): error TS2322: Type 'Base' is not assignable to type 'i3'.
|
||||
Type 'Base' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(131,5): error TS2322: Type '() => void' is not assignable to type 'i3'.
|
||||
Type '() => void' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(134,5): error TS2322: Type 'boolean' is not assignable to type 'i3'.
|
||||
tests/cases/compiler/intTypeCheck.ts(134,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(134,22): error TS2304: Cannot find name 'i3'.
|
||||
@@ -50,9 +57,12 @@ tests/cases/compiler/intTypeCheck.ts(162,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(162,22): error TS2304: Cannot find name 'i5'.
|
||||
tests/cases/compiler/intTypeCheck.ts(163,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(168,5): error TS2322: Type '{}' is not assignable to type 'i6'.
|
||||
Type '{}' provides no match for the signature '(): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(169,5): error TS2322: Type 'Object' is not assignable to type 'i6'.
|
||||
Type 'Object' provides no match for the signature '(): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(170,17): error TS2350: Only a void function can be called with the 'new' keyword.
|
||||
tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type 'Base' is not assignable to type 'i6'.
|
||||
Type 'Base' provides no match for the signature '(): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(173,5): error TS2322: Type '() => void' is not assignable to type 'i6'.
|
||||
Type 'void' is not assignable to type 'number'.
|
||||
tests/cases/compiler/intTypeCheck.ts(176,5): error TS2322: Type 'boolean' is not assignable to type 'i6'.
|
||||
@@ -60,9 +70,13 @@ tests/cases/compiler/intTypeCheck.ts(176,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(176,22): error TS2304: Cannot find name 'i6'.
|
||||
tests/cases/compiler/intTypeCheck.ts(177,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
|
||||
tests/cases/compiler/intTypeCheck.ts(182,5): error TS2322: Type '{}' is not assignable to type 'i7'.
|
||||
Type '{}' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(183,5): error TS2322: Type 'Object' is not assignable to type 'i7'.
|
||||
Type 'Object' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(185,17): error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other.
|
||||
Type 'Base' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is not assignable to type 'i7'.
|
||||
Type '() => void' provides no match for the signature 'new (): any'
|
||||
tests/cases/compiler/intTypeCheck.ts(190,5): error TS2322: Type 'boolean' is not assignable to type 'i7'.
|
||||
tests/cases/compiler/intTypeCheck.ts(190,21): error TS1109: Expression expected.
|
||||
tests/cases/compiler/intTypeCheck.ts(190,22): error TS2304: Cannot find name 'i7'.
|
||||
@@ -216,15 +230,18 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
var obj12: i2 = {};
|
||||
~~~~~
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'i2'.
|
||||
!!! error TS2322: Type '{}' provides no match for the signature '(): any'
|
||||
var obj13: i2 = new Object();
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'i2'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): any'
|
||||
var obj14: i2 = new obj11;
|
||||
~~~~~~~~~
|
||||
!!! error TS2350: Only a void function can be called with the 'new' keyword.
|
||||
var obj15: i2 = new Base;
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'Base' is not assignable to type 'i2'.
|
||||
!!! error TS2322: Type 'Base' provides no match for the signature '(): any'
|
||||
var obj16: i2 = null;
|
||||
var obj17: i2 = function ():any { return 0; };
|
||||
//var obj18: i2 = function foo() { };
|
||||
@@ -246,17 +263,21 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
var obj23: i3 = {};
|
||||
~~~~~
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'i3'.
|
||||
!!! error TS2322: Type '{}' provides no match for the signature 'new (): any'
|
||||
var obj24: i3 = new Object();
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'i3'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
|
||||
var obj25: i3 = new obj22;
|
||||
var obj26: i3 = new Base;
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'Base' is not assignable to type 'i3'.
|
||||
!!! error TS2322: Type 'Base' provides no match for the signature 'new (): any'
|
||||
var obj27: i3 = null;
|
||||
var obj28: i3 = function () { };
|
||||
~~~~~
|
||||
!!! error TS2322: Type '() => void' is not assignable to type 'i3'.
|
||||
!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any'
|
||||
//var obj29: i3 = function foo() { };
|
||||
var obj30: i3 = <i3> anyVar;
|
||||
var obj31: i3 = new <i3> anyVar;
|
||||
@@ -338,15 +359,18 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
var obj56: i6 = {};
|
||||
~~~~~
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'i6'.
|
||||
!!! error TS2322: Type '{}' provides no match for the signature '(): any'
|
||||
var obj57: i6 = new Object();
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'i6'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): any'
|
||||
var obj58: i6 = new obj55;
|
||||
~~~~~~~~~
|
||||
!!! error TS2350: Only a void function can be called with the 'new' keyword.
|
||||
var obj59: i6 = new Base;
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'Base' is not assignable to type 'i6'.
|
||||
!!! error TS2322: Type 'Base' provides no match for the signature '(): any'
|
||||
var obj60: i6 = null;
|
||||
var obj61: i6 = function () { };
|
||||
~~~~~
|
||||
@@ -371,17 +395,21 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
|
||||
var obj67: i7 = {};
|
||||
~~~~~
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'i7'.
|
||||
!!! error TS2322: Type '{}' provides no match for the signature 'new (): any'
|
||||
var obj68: i7 = new Object();
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'i7'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
|
||||
var obj69: i7 = new obj66;
|
||||
var obj70: i7 = <i7>new Base;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other.
|
||||
!!! error TS2352: Type 'Base' provides no match for the signature 'new (): any'
|
||||
var obj71: i7 = null;
|
||||
var obj72: i7 = function () { };
|
||||
~~~~~
|
||||
!!! error TS2322: Type '() => void' is not assignable to type 'i7'.
|
||||
!!! error TS2322: Type '() => void' provides no match for the signature 'new (): any'
|
||||
//var obj73: i7 = function foo() { };
|
||||
var obj74: i7 = <i7> anyVar;
|
||||
var obj75: i7 = new <i7> anyVar;
|
||||
|
||||
@@ -3,6 +3,7 @@ tests/cases/compiler/interfaceImplementation1.ts(12,7): error TS2420: Class 'C1'
|
||||
tests/cases/compiler/interfaceImplementation1.ts(12,7): error TS2420: Class 'C1' incorrectly implements interface 'I2'.
|
||||
Property 'iFn' is private in type 'C1' but not in type 'I2'.
|
||||
tests/cases/compiler/interfaceImplementation1.ts(34,5): error TS2322: Type '() => C2' is not assignable to type 'I4'.
|
||||
Type '() => C2' provides no match for the signature 'new (): I3'
|
||||
|
||||
|
||||
==== tests/cases/compiler/interfaceImplementation1.ts (3 errors) ====
|
||||
@@ -48,6 +49,7 @@ tests/cases/compiler/interfaceImplementation1.ts(34,5): error TS2322: Type '() =
|
||||
var a:I4 = function(){
|
||||
~
|
||||
!!! error TS2322: Type '() => C2' is not assignable to type 'I4'.
|
||||
!!! error TS2322: Type '() => C2' provides no match for the signature 'new (): I3'
|
||||
return new C2();
|
||||
}
|
||||
new a();
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
tests/cases/compiler/a.js(1,5): error TS2300: Duplicate identifier 'a'.
|
||||
tests/cases/compiler/a.js(2,7): error TS2300: Duplicate identifier 'a'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.js (2 errors) ====
|
||||
var a = 10;
|
||||
~
|
||||
!!! error TS2300: Duplicate identifier 'a'.
|
||||
class a {
|
||||
~
|
||||
!!! error TS2300: Duplicate identifier 'a'.
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
tests/cases/compiler/a.js(1,5): error TS2451: Cannot redeclare block-scoped variable 'C'.
|
||||
tests/cases/compiler/a.js(2,5): error TS2451: Cannot redeclare block-scoped variable 'C'.
|
||||
tests/cases/compiler/a.js(6,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/a.js(11,9): error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.js (4 errors) ====
|
||||
let C = "sss";
|
||||
~
|
||||
!!! error TS2451: Cannot redeclare block-scoped variable 'C'.
|
||||
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
|
||||
~
|
||||
!!! error TS2451: Cannot redeclare block-scoped variable 'C'.
|
||||
|
||||
function f() {
|
||||
return;
|
||||
return; // Error: Unreachable code detected.
|
||||
~~~~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
|
||||
function b() {
|
||||
"use strict";
|
||||
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
|
||||
~~~~~~~~~
|
||||
!!! error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
//// [a.js]
|
||||
let C = "sss";
|
||||
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
|
||||
|
||||
function f() {
|
||||
return;
|
||||
return; // Error: Unreachable code detected.
|
||||
}
|
||||
|
||||
function b() {
|
||||
"use strict";
|
||||
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
|
||||
}
|
||||
|
||||
//// [a.js]
|
||||
var C = "sss";
|
||||
var C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
|
||||
function f() {
|
||||
return;
|
||||
return; // Error: Unreachable code detected.
|
||||
}
|
||||
function b() {
|
||||
"use strict";
|
||||
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
=== tests/cases/compiler/a.js ===
|
||||
let C = "sss";
|
||||
>C : Symbol(C, Decl(a.js, 0, 3))
|
||||
|
||||
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
|
||||
>C : Symbol(C, Decl(a.js, 1, 3))
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(a.js, 1, 10))
|
||||
|
||||
return;
|
||||
return; // Error: Unreachable code detected.
|
||||
}
|
||||
|
||||
function b() {
|
||||
>b : Symbol(b, Decl(a.js, 6, 1))
|
||||
|
||||
"use strict";
|
||||
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
|
||||
>arguments : Symbol(arguments, Decl(a.js, 10, 7))
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
=== tests/cases/compiler/a.js ===
|
||||
let C = "sss";
|
||||
>C : string
|
||||
>"sss" : string
|
||||
|
||||
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
|
||||
>C : number
|
||||
>0 : number
|
||||
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
return;
|
||||
return; // Error: Unreachable code detected.
|
||||
}
|
||||
|
||||
function b() {
|
||||
>b : () => void
|
||||
|
||||
"use strict";
|
||||
>"use strict" : string
|
||||
|
||||
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
|
||||
>arguments : number
|
||||
>0 : number
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
tests/cases/compiler/a.js(1,22): error TS2528: A module cannot have multiple default exports.
|
||||
tests/cases/compiler/a.js(3,1): error TS2528: A module cannot have multiple default exports.
|
||||
tests/cases/compiler/a.js(3,1): error TS8003: 'export=' can only be used in a .ts file.
|
||||
tests/cases/compiler/a.js(3,16): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.js (4 errors) ====
|
||||
export default class a {
|
||||
~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
}
|
||||
export default var a = 10;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2528: A module cannot have multiple default exports.
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS8003: 'export=' can only be used in a .ts file.
|
||||
~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
@@ -0,0 +1,31 @@
|
||||
tests/cases/compiler/a.js(3,9): error TS7029: Fallthrough case in switch.
|
||||
tests/cases/compiler/a.js(16,5): error TS7027: Unreachable code detected.
|
||||
tests/cases/compiler/a.js(19,1): error TS7028: Unused label.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.js (3 errors) ====
|
||||
function foo(a, b) {
|
||||
switch (a) {
|
||||
case 10:
|
||||
~~~~
|
||||
!!! error TS7029: Fallthrough case in switch.
|
||||
if (b) {
|
||||
return b;
|
||||
}
|
||||
case 20:
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
function bar() {
|
||||
return x;
|
||||
function bar2() {
|
||||
}
|
||||
var x = 10; // error
|
||||
~~~
|
||||
!!! error TS7027: Unreachable code detected.
|
||||
}
|
||||
|
||||
label1: var x2 = 10;
|
||||
~~~~~~
|
||||
!!! error TS7028: Unused label.
|
||||
@@ -0,0 +1,81 @@
|
||||
tests/cases/compiler/a.js(3,5): error TS2300: Duplicate identifier 'a'.
|
||||
tests/cases/compiler/a.js(5,5): error TS1117: An object literal cannot have multiple properties with the same name in strict mode.
|
||||
tests/cases/compiler/a.js(5,5): error TS2300: Duplicate identifier 'a'.
|
||||
tests/cases/compiler/a.js(7,5): error TS1212: Identifier expected. 'let' is a reserved word in strict mode
|
||||
tests/cases/compiler/a.js(8,8): error TS1102: 'delete' cannot be called on an identifier in strict mode.
|
||||
tests/cases/compiler/a.js(10,10): error TS1100: Invalid use of 'eval' in strict mode.
|
||||
tests/cases/compiler/a.js(12,10): error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
tests/cases/compiler/a.js(15,1): error TS1101: 'with' statements are not allowed in strict mode.
|
||||
tests/cases/compiler/b.js(3,7): error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode.
|
||||
tests/cases/compiler/b.js(6,13): error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
tests/cases/compiler/c.js(1,12): error TS1214: Identifier expected. 'let' is a reserved word in strict mode. Modules are automatically in strict mode.
|
||||
tests/cases/compiler/c.js(2,5): error TS1215: Invalid use of 'eval'. Modules are automatically in strict mode.
|
||||
tests/cases/compiler/d.js(2,9): error TS1121: Octal literals are not allowed in strict mode.
|
||||
tests/cases/compiler/d.js(2,11): error TS1005: ',' expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.js (8 errors) ====
|
||||
"use strict";
|
||||
var a = {
|
||||
a: "hello", // error
|
||||
~
|
||||
!!! error TS2300: Duplicate identifier 'a'.
|
||||
b: 10,
|
||||
a: 10 // error
|
||||
~
|
||||
!!! error TS1117: An object literal cannot have multiple properties with the same name in strict mode.
|
||||
~
|
||||
!!! error TS2300: Duplicate identifier 'a'.
|
||||
};
|
||||
var let = 10; // error
|
||||
~~~
|
||||
!!! error TS1212: Identifier expected. 'let' is a reserved word in strict mode
|
||||
delete a; // error
|
||||
~
|
||||
!!! error TS1102: 'delete' cannot be called on an identifier in strict mode.
|
||||
try {
|
||||
} catch (eval) { // error
|
||||
~~~~
|
||||
!!! error TS1100: Invalid use of 'eval' in strict mode.
|
||||
}
|
||||
function arguments() { // error
|
||||
~~~~~~~~~
|
||||
!!! error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
}
|
||||
|
||||
with (a) {
|
||||
~~~~
|
||||
!!! error TS1101: 'with' statements are not allowed in strict mode.
|
||||
b = 10;
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/b.js (2 errors) ====
|
||||
// this is not in strict mode but class definitions are always in strict mode
|
||||
class c {
|
||||
a(eval) { //error
|
||||
~~~~
|
||||
!!! error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode.
|
||||
}
|
||||
method() {
|
||||
var let = 10; // error
|
||||
~~~
|
||||
!!! error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/c.js (2 errors) ====
|
||||
export var let = 10; // external modules are automatically in strict mode
|
||||
~~~
|
||||
!!! error TS1214: Identifier expected. 'let' is a reserved word in strict mode. Modules are automatically in strict mode.
|
||||
var eval = function () {
|
||||
~~~~
|
||||
!!! error TS1215: Invalid use of 'eval'. Modules are automatically in strict mode.
|
||||
};
|
||||
|
||||
==== tests/cases/compiler/d.js (2 errors) ====
|
||||
"use strict";
|
||||
var x = 009; // error
|
||||
~~
|
||||
!!! error TS1121: Octal literals are not allowed in strict mode.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
@@ -1,9 +1,12 @@
|
||||
error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file.
|
||||
tests/cases/compiler/a.js(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
|
||||
tests/cases/compiler/a.js(1,1): error TS8003: 'export=' can only be used in a .ts file.
|
||||
|
||||
|
||||
!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file.
|
||||
==== tests/cases/compiler/a.js (1 errors) ====
|
||||
==== tests/cases/compiler/a.js (2 errors) ====
|
||||
export = b;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS8003: 'export=' can only be used in a .ts file.
|
||||
@@ -0,0 +1,19 @@
|
||||
tests/cases/compiler/moduleA/a.js(2,17): error TS2656: Exported external package typings file 'tests/cases/compiler/node_modules/b.ts' is not a module. Please contact the package author to update the package definition.
|
||||
|
||||
|
||||
==== tests/cases/compiler/moduleA/a.js (1 errors) ====
|
||||
|
||||
import {a} from "b";
|
||||
~~~
|
||||
!!! error TS2656: Exported external package typings file 'b.ts' is not a module. Please contact the package author to update the package definition.
|
||||
a++;
|
||||
import {c} from "c";
|
||||
c++;
|
||||
|
||||
==== tests/cases/compiler/node_modules/b.ts (0 errors) ====
|
||||
var a = 10;
|
||||
|
||||
==== tests/cases/compiler/node_modules/c.js (0 errors) ====
|
||||
exports.a = 10;
|
||||
c = 10;
|
||||
|
||||
+5
-1
@@ -1,5 +1,7 @@
|
||||
tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'.
|
||||
Type 'Object' provides no match for the signature '(): void'
|
||||
tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts(14,1): error TS2322: Type 'Object' is not assignable to type '() => void'.
|
||||
Type 'Object' provides no match for the signature '(): void'
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOfFunctionAssignmentCompat.ts (2 errors) ====
|
||||
@@ -13,6 +15,7 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOf
|
||||
i = f;
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'I'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): void'
|
||||
|
||||
var a: {
|
||||
(): void
|
||||
@@ -20,4 +23,5 @@ tests/cases/conformance/types/members/objectTypeWithCallSignatureHidingMembersOf
|
||||
f = a;
|
||||
a = f;
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type '() => void'.
|
||||
!!! error TS2322: Type 'Object' is not assignable to type '() => void'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature '(): void'
|
||||
+5
-1
@@ -1,5 +1,7 @@
|
||||
tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts(8,1): error TS2322: Type 'Object' is not assignable to type 'I'.
|
||||
Type 'Object' provides no match for the signature 'new (): any'
|
||||
tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts(14,1): error TS2322: Type 'Object' is not assignable to type 'new () => any'.
|
||||
Type 'Object' provides no match for the signature 'new (): any'
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMembersOfFunctionAssignmentCompat.ts (2 errors) ====
|
||||
@@ -13,6 +15,7 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMemb
|
||||
i = f;
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'I'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
|
||||
|
||||
var a: {
|
||||
new(): any
|
||||
@@ -20,4 +23,5 @@ tests/cases/conformance/types/members/objectTypeWithConstructSignatureHidingMemb
|
||||
f = a;
|
||||
a = f;
|
||||
~
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'new () => any'.
|
||||
!!! error TS2322: Type 'Object' is not assignable to type 'new () => any'.
|
||||
!!! error TS2322: Type 'Object' provides no match for the signature 'new (): any'
|
||||
@@ -0,0 +1,27 @@
|
||||
//// [tests/cases/conformance/es6/moduleExportsAmd/outFilerootDirModuleNamesAmd.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
import foo from "./b";
|
||||
export default class Foo {}
|
||||
foo();
|
||||
|
||||
//// [b.ts]
|
||||
import Foo from "./a";
|
||||
export default function foo() { new Foo(); }
|
||||
|
||||
|
||||
//// [output.js]
|
||||
define("b", ["require", "exports", "a"], function (require, exports, a_1) {
|
||||
"use strict";
|
||||
function foo() { new a_1.default(); }
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = foo;
|
||||
});
|
||||
define("a", ["require", "exports", "b"], function (require, exports, b_1) {
|
||||
"use strict";
|
||||
class Foo {
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = Foo;
|
||||
b_1.default();
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/src/a.ts ===
|
||||
import foo from "./b";
|
||||
>foo : Symbol(foo, Decl(a.ts, 0, 6))
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 22))
|
||||
|
||||
foo();
|
||||
>foo : Symbol(foo, Decl(a.ts, 0, 6))
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/src/b.ts ===
|
||||
import Foo from "./a";
|
||||
>Foo : Symbol(Foo, Decl(b.ts, 0, 6))
|
||||
|
||||
export default function foo() { new Foo(); }
|
||||
>foo : Symbol(foo, Decl(b.ts, 0, 22))
|
||||
>Foo : Symbol(Foo, Decl(b.ts, 0, 6))
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/src/a.ts ===
|
||||
import foo from "./b";
|
||||
>foo : () => void
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
||||
foo();
|
||||
>foo() : void
|
||||
>foo : () => void
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsAmd/src/b.ts ===
|
||||
import Foo from "./a";
|
||||
>Foo : typeof Foo
|
||||
|
||||
export default function foo() { new Foo(); }
|
||||
>foo : () => void
|
||||
>new Foo() : Foo
|
||||
>Foo : typeof Foo
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
//// [tests/cases/conformance/es6/moduleExportsSystem/outFilerootDirModuleNamesSystem.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
import foo from "./b";
|
||||
export default class Foo {}
|
||||
foo();
|
||||
|
||||
//// [b.ts]
|
||||
import Foo from "./a";
|
||||
export default function foo() { new Foo(); }
|
||||
|
||||
|
||||
//// [output.js]
|
||||
System.register("b", ["a"], function(exports_1) {
|
||||
"use strict";
|
||||
var a_1;
|
||||
function foo() { new a_1.default(); }
|
||||
exports_1("default", foo);
|
||||
return {
|
||||
setters:[
|
||||
function (a_1_1) {
|
||||
a_1 = a_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
System.register("a", ["b"], function(exports_2) {
|
||||
"use strict";
|
||||
var b_1;
|
||||
var Foo;
|
||||
return {
|
||||
setters:[
|
||||
function (b_1_1) {
|
||||
b_1 = b_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
class Foo {
|
||||
}
|
||||
exports_2("default", Foo);
|
||||
b_1.default();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/src/a.ts ===
|
||||
import foo from "./b";
|
||||
>foo : Symbol(foo, Decl(a.ts, 0, 6))
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 22))
|
||||
|
||||
foo();
|
||||
>foo : Symbol(foo, Decl(a.ts, 0, 6))
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/src/b.ts ===
|
||||
import Foo from "./a";
|
||||
>Foo : Symbol(Foo, Decl(b.ts, 0, 6))
|
||||
|
||||
export default function foo() { new Foo(); }
|
||||
>foo : Symbol(foo, Decl(b.ts, 0, 22))
|
||||
>Foo : Symbol(Foo, Decl(b.ts, 0, 6))
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/src/a.ts ===
|
||||
import foo from "./b";
|
||||
>foo : () => void
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
||||
foo();
|
||||
>foo() : void
|
||||
>foo : () => void
|
||||
|
||||
=== tests/cases/conformance/es6/moduleExportsSystem/src/b.ts ===
|
||||
import Foo from "./a";
|
||||
>Foo : typeof Foo
|
||||
|
||||
export default function foo() { new Foo(); }
|
||||
>foo : () => void
|
||||
>new Foo() : Foo
|
||||
>Foo : typeof Foo
|
||||
|
||||
@@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || function (d, b) {
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
define("tests/cases/compiler/ref/a", ["require", "exports"], function (require, exports) {
|
||||
define("ref/a", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var A = (function () {
|
||||
function A() {
|
||||
@@ -23,7 +23,7 @@ define("tests/cases/compiler/ref/a", ["require", "exports"], function (require,
|
||||
})();
|
||||
exports.A = A;
|
||||
});
|
||||
define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/ref/a"], function (require, exports, a_1) {
|
||||
define("b", ["require", "exports", "ref/a"], function (require, exports, a_1) {
|
||||
"use strict";
|
||||
var B = (function (_super) {
|
||||
__extends(B, _super);
|
||||
@@ -37,12 +37,12 @@ define("tests/cases/compiler/b", ["require", "exports", "tests/cases/compiler/re
|
||||
//# sourceMappingURL=all.js.map
|
||||
|
||||
//// [all.d.ts]
|
||||
declare module "tests/cases/compiler/ref/a" {
|
||||
declare module "ref/a" {
|
||||
export class A {
|
||||
}
|
||||
}
|
||||
declare module "tests/cases/compiler/b" {
|
||||
import { A } from "tests/cases/compiler/ref/a";
|
||||
declare module "b" {
|
||||
import { A } from "ref/a";
|
||||
export class B extends A {
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user