mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into remove-jake
This commit is contained in:
Vendored
+13
-1
@@ -152,12 +152,24 @@ interface ObjectConstructor {
|
||||
*/
|
||||
getOwnPropertyNames(o: any): string[];
|
||||
|
||||
/**
|
||||
* Creates an object that has null prototype.
|
||||
* @param o Object to use as a prototype. May be null
|
||||
*/
|
||||
create(o: null): any;
|
||||
|
||||
/**
|
||||
* Creates an object that has the specified prototype, and that optionally contains specified properties.
|
||||
* @param o Object to use as a prototype. May be null
|
||||
*/
|
||||
create<T>(o: T): T;
|
||||
|
||||
/**
|
||||
* Creates an object that has the specified prototype, and that optionally contains specified properties.
|
||||
* @param o Object to use as a prototype. May be null
|
||||
* @param properties JavaScript object that contains one or more property descriptors.
|
||||
*/
|
||||
create(o: any, properties?: PropertyDescriptorMap): any;
|
||||
create(o: any, properties: PropertyDescriptorMap): any;
|
||||
|
||||
/**
|
||||
* Adds a property to an object, or modifies attributes of an existing property.
|
||||
|
||||
Vendored
+2
-1
@@ -15,4 +15,5 @@ and limitations under the License.
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
/// <reference path="lib.es2016.d.ts" />
|
||||
/// <reference path="lib.es2017.object.d.ts" />
|
||||
/// <reference path="lib.es2017.object.d.ts" />
|
||||
/// <reference path="lib.es2017.sharedmemory.d.ts" />
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
/// <reference path="lib.es2015.symbol.d.ts" />
|
||||
/// <reference path="lib.es2015.symbol.wellknown.d.ts" />
|
||||
|
||||
interface SharedArrayBuffer {
|
||||
/**
|
||||
* Read-only. The length of the ArrayBuffer (in bytes).
|
||||
*/
|
||||
readonly byteLength: number;
|
||||
|
||||
/*
|
||||
* The SharedArrayBuffer constructor's length property whose value is 1.
|
||||
*/
|
||||
length: number;
|
||||
/**
|
||||
* Returns a section of an SharedArrayBuffer.
|
||||
*/
|
||||
slice(begin:number, end?:number): SharedArrayBuffer;
|
||||
readonly [Symbol.species]: SharedArrayBuffer;
|
||||
readonly [Symbol.toStringTag]: "SharedArrayBuffer";
|
||||
}
|
||||
|
||||
interface SharedArrayBufferConstructor {
|
||||
readonly prototype: SharedArrayBuffer;
|
||||
new (byteLength: number): SharedArrayBuffer;
|
||||
}
|
||||
|
||||
declare var SharedArrayBuffer: SharedArrayBufferConstructor;
|
||||
Vendored
+13
-1
@@ -152,12 +152,24 @@ interface ObjectConstructor {
|
||||
*/
|
||||
getOwnPropertyNames(o: any): string[];
|
||||
|
||||
/**
|
||||
* Creates an object that has null prototype.
|
||||
* @param o Object to use as a prototype. May be null
|
||||
*/
|
||||
create(o: null): any;
|
||||
|
||||
/**
|
||||
* Creates an object that has the specified prototype, and that optionally contains specified properties.
|
||||
* @param o Object to use as a prototype. May be null
|
||||
*/
|
||||
create<T>(o: T): T;
|
||||
|
||||
/**
|
||||
* Creates an object that has the specified prototype, and that optionally contains specified properties.
|
||||
* @param o Object to use as a prototype. May be null
|
||||
* @param properties JavaScript object that contains one or more property descriptors.
|
||||
*/
|
||||
create(o: any, properties?: PropertyDescriptorMap): any;
|
||||
create(o: any, properties: PropertyDescriptorMap): any;
|
||||
|
||||
/**
|
||||
* Adds a property to an object, or modifies attributes of an existing property.
|
||||
|
||||
Vendored
+13
-1
@@ -152,12 +152,24 @@ interface ObjectConstructor {
|
||||
*/
|
||||
getOwnPropertyNames(o: any): string[];
|
||||
|
||||
/**
|
||||
* Creates an object that has null prototype.
|
||||
* @param o Object to use as a prototype. May be null
|
||||
*/
|
||||
create(o: null): any;
|
||||
|
||||
/**
|
||||
* Creates an object that has the specified prototype, and that optionally contains specified properties.
|
||||
* @param o Object to use as a prototype. May be null
|
||||
*/
|
||||
create<T>(o: T): T;
|
||||
|
||||
/**
|
||||
* Creates an object that has the specified prototype, and that optionally contains specified properties.
|
||||
* @param o Object to use as a prototype. May be null
|
||||
* @param properties JavaScript object that contains one or more property descriptors.
|
||||
*/
|
||||
create(o: any, properties?: PropertyDescriptorMap): any;
|
||||
create(o: any, properties: PropertyDescriptorMap): any;
|
||||
|
||||
/**
|
||||
* Adds a property to an object, or modifies attributes of an existing property.
|
||||
|
||||
+38042
-37654
File diff suppressed because one or more lines are too long
+52451
-51851
File diff suppressed because one or more lines are too long
Vendored
+8715
-8648
File diff suppressed because it is too large
Load Diff
+52217
-51617
File diff suppressed because one or more lines are too long
Vendored
+2508
-2488
File diff suppressed because it is too large
Load Diff
+58975
-58311
File diff suppressed because one or more lines are too long
Vendored
+2508
-2488
File diff suppressed because it is too large
Load Diff
+58975
-58311
File diff suppressed because one or more lines are too long
@@ -53,7 +53,8 @@ namespace ts {
|
||||
return state;
|
||||
}
|
||||
else if (node.kind === SyntaxKind.ModuleDeclaration) {
|
||||
return getModuleInstanceState((<ModuleDeclaration>node).body);
|
||||
const body = (<ModuleDeclaration>node).body;
|
||||
return body ? getModuleInstanceState(body) : ModuleInstanceState.Instantiated;
|
||||
}
|
||||
else {
|
||||
return ModuleInstanceState.Instantiated;
|
||||
@@ -1258,7 +1259,7 @@ namespace ts {
|
||||
|
||||
function hasExportDeclarations(node: ModuleDeclaration | SourceFile): boolean {
|
||||
const body = node.kind === SyntaxKind.SourceFile ? node : (<ModuleDeclaration>node).body;
|
||||
if (body.kind === SyntaxKind.SourceFile || body.kind === SyntaxKind.ModuleBlock) {
|
||||
if (body && (body.kind === SyntaxKind.SourceFile || body.kind === SyntaxKind.ModuleBlock)) {
|
||||
for (const stat of (<Block>body).statements) {
|
||||
if (stat.kind === SyntaxKind.ExportDeclaration || stat.kind === SyntaxKind.ExportAssignment) {
|
||||
return true;
|
||||
|
||||
+25
-6
@@ -992,7 +992,9 @@ namespace ts {
|
||||
const moduleSymbol = resolveExternalModuleName(node, (<ImportDeclaration>node.parent).moduleSpecifier);
|
||||
|
||||
if (moduleSymbol) {
|
||||
const exportDefaultSymbol = moduleSymbol.exports["export="] ?
|
||||
const exportDefaultSymbol = isShorthandAmbientModule(moduleSymbol.valueDeclaration) ?
|
||||
moduleSymbol :
|
||||
moduleSymbol.exports["export="] ?
|
||||
getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") :
|
||||
resolveSymbol(moduleSymbol.exports["default"]);
|
||||
|
||||
@@ -1066,6 +1068,10 @@ namespace ts {
|
||||
if (targetSymbol) {
|
||||
const name = specifier.propertyName || specifier.name;
|
||||
if (name.text) {
|
||||
if (isShorthandAmbientModule(moduleSymbol.valueDeclaration)) {
|
||||
return moduleSymbol;
|
||||
}
|
||||
|
||||
let symbolFromVariable: Symbol;
|
||||
// First check if module was specified with "export=". If so, get the member from the resolved type
|
||||
if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) {
|
||||
@@ -3234,9 +3240,14 @@ namespace ts {
|
||||
function getTypeOfFuncClassEnumModule(symbol: Symbol): Type {
|
||||
const links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
const type = createObjectType(TypeFlags.Anonymous, symbol);
|
||||
links.type = strictNullChecks && symbol.flags & SymbolFlags.Optional ?
|
||||
addTypeKind(type, TypeFlags.Undefined) : type;
|
||||
if (symbol.valueDeclaration.kind === SyntaxKind.ModuleDeclaration && isShorthandAmbientModule(<ModuleDeclaration>symbol.valueDeclaration)) {
|
||||
links.type = anyType;
|
||||
}
|
||||
else {
|
||||
const type = createObjectType(TypeFlags.Anonymous, symbol);
|
||||
links.type = strictNullChecks && symbol.flags & SymbolFlags.Optional ?
|
||||
addTypeKind(type, TypeFlags.Undefined) : type;
|
||||
}
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
@@ -16052,7 +16063,7 @@ namespace ts {
|
||||
// - augmentation for a global scope is always applied
|
||||
// - augmentation for some external module is applied if symbol for augmentation is merged (it was combined with target module).
|
||||
const checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & SymbolFlags.Merged);
|
||||
if (checkBody) {
|
||||
if (checkBody && node.body) {
|
||||
// body of ambient external module is always a module block
|
||||
for (const statement of (<ModuleBlock>node.body).statements) {
|
||||
checkModuleAugmentationElement(statement, isGlobalAugmentation);
|
||||
@@ -16079,7 +16090,15 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
checkSourceElement(node.body);
|
||||
|
||||
if (compilerOptions.noImplicitAny && !node.body) {
|
||||
// Ambient shorthand module is an implicit any
|
||||
reportImplicitAnyError(node, anyType);
|
||||
}
|
||||
|
||||
if (node.body) {
|
||||
checkSourceElement(node.body);
|
||||
}
|
||||
}
|
||||
|
||||
function checkModuleAugmentationElement(node: Node, isGlobalAugmentation: boolean): void {
|
||||
|
||||
@@ -853,21 +853,26 @@ namespace ts {
|
||||
writeTextOfNode(currentText, node.name);
|
||||
}
|
||||
}
|
||||
while (node.body.kind !== SyntaxKind.ModuleBlock) {
|
||||
while (node.body && node.body.kind !== SyntaxKind.ModuleBlock) {
|
||||
node = <ModuleDeclaration>node.body;
|
||||
write(".");
|
||||
writeTextOfNode(currentText, node.name);
|
||||
}
|
||||
const prevEnclosingDeclaration = enclosingDeclaration;
|
||||
enclosingDeclaration = node;
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
emitLines((<ModuleBlock>node.body).statements);
|
||||
decreaseIndent();
|
||||
write("}");
|
||||
writeLine();
|
||||
enclosingDeclaration = prevEnclosingDeclaration;
|
||||
if (node.body) {
|
||||
enclosingDeclaration = node;
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
emitLines((<ModuleBlock>node.body).statements);
|
||||
decreaseIndent();
|
||||
write("}");
|
||||
writeLine();
|
||||
enclosingDeclaration = prevEnclosingDeclaration;
|
||||
}
|
||||
else {
|
||||
write(";");
|
||||
}
|
||||
}
|
||||
|
||||
function writeTypeAliasDeclaration(node: TypeAliasDeclaration) {
|
||||
|
||||
@@ -635,10 +635,6 @@
|
||||
"category": "Error",
|
||||
"code": 1203
|
||||
},
|
||||
"Cannot compile modules into 'es2015' when targeting 'ES5' or lower.": {
|
||||
"category": "Error",
|
||||
"code": 1204
|
||||
},
|
||||
"Decorators are not valid here.": {
|
||||
"category": "Error",
|
||||
"code": 1206
|
||||
|
||||
+13
-2
@@ -5613,7 +5613,11 @@ const _super = (function (geti, seti) {
|
||||
}
|
||||
|
||||
function emitClassLikeDeclarationBelowES6(node: ClassLikeDeclaration) {
|
||||
const isES6ExportedClass = isES6ExportedDeclaration(node);
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
if (isES6ExportedClass && !(node.flags & NodeFlags.Default)) {
|
||||
write("export ");
|
||||
}
|
||||
// source file level classes in system modules are hoisted so 'var's for them are already defined
|
||||
if (!shouldHoistDeclarationInSystemJsModule(node)) {
|
||||
write("var ");
|
||||
@@ -5683,9 +5687,15 @@ const _super = (function (geti, seti) {
|
||||
}
|
||||
emitEnd(node);
|
||||
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
if (node.kind === SyntaxKind.ClassDeclaration && !isES6ExportedClass) {
|
||||
emitExportMemberAssignment(<ClassDeclaration>node);
|
||||
}
|
||||
else if (isES6ExportedClass && (node.flags & NodeFlags.Default)) {
|
||||
writeLine();
|
||||
write("export default ");
|
||||
emitDeclarationName(node);
|
||||
write(";");
|
||||
}
|
||||
}
|
||||
|
||||
function emitClassMemberPrefix(node: ClassLikeDeclaration, member: Node) {
|
||||
@@ -6300,7 +6310,7 @@ const _super = (function (geti, seti) {
|
||||
}
|
||||
|
||||
function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration: ModuleDeclaration): ModuleDeclaration {
|
||||
if (moduleDeclaration.body.kind === SyntaxKind.ModuleDeclaration) {
|
||||
if (moduleDeclaration.body && moduleDeclaration.body.kind === SyntaxKind.ModuleDeclaration) {
|
||||
const recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(<ModuleDeclaration>moduleDeclaration.body);
|
||||
return recursiveInnerModule || <ModuleDeclaration>moduleDeclaration.body;
|
||||
}
|
||||
@@ -6349,6 +6359,7 @@ const _super = (function (geti, seti) {
|
||||
write(getGeneratedNameForNode(node));
|
||||
emitEnd(node.name);
|
||||
write(") ");
|
||||
Debug.assert(node.body !== undefined); // node.body must exist, as this is a non-ambient module
|
||||
if (node.body.kind === SyntaxKind.ModuleBlock) {
|
||||
const saveConvertedLoopState = convertedLoopState;
|
||||
const saveTempFlags = tempFlags;
|
||||
|
||||
@@ -5337,7 +5337,14 @@ namespace ts {
|
||||
else {
|
||||
node.name = parseLiteralNode(/*internName*/ true);
|
||||
}
|
||||
node.body = parseModuleBlock();
|
||||
|
||||
if (token === SyntaxKind.OpenBraceToken) {
|
||||
node.body = parseModuleBlock();
|
||||
}
|
||||
else {
|
||||
parseSemicolon();
|
||||
}
|
||||
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
|
||||
@@ -1775,9 +1775,12 @@ namespace ts {
|
||||
// The StringLiteral must specify a top - level external module name.
|
||||
// Relative external module names are not permitted
|
||||
|
||||
// NOTE: body of ambient module is always a module block
|
||||
for (const statement of (<ModuleBlock>(<ModuleDeclaration>node).body).statements) {
|
||||
collectModuleReferences(statement, /*inAmbientModule*/ true);
|
||||
// NOTE: body of ambient module is always a module block, if it exists
|
||||
const body = <ModuleBlock>(<ModuleDeclaration>node).body;
|
||||
if (body) {
|
||||
for (const statement of body.statements) {
|
||||
collectModuleReferences(statement, /*inAmbientModule*/ true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2157,11 +2160,6 @@ namespace ts {
|
||||
programDiagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));
|
||||
}
|
||||
|
||||
// Cannot specify module gen target of es6 when below es6
|
||||
if (options.module === ModuleKind.ES6 && languageVersion < ScriptTarget.ES6) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower));
|
||||
}
|
||||
|
||||
// Cannot specify module gen that isn't amd or system with --out
|
||||
if (outFile) {
|
||||
if (options.module && !(options.module === ModuleKind.AMD || options.module === ModuleKind.System)) {
|
||||
|
||||
@@ -1301,7 +1301,7 @@ namespace ts {
|
||||
// @kind(SyntaxKind.ModuleDeclaration)
|
||||
export interface ModuleDeclaration extends DeclarationStatement {
|
||||
name: Identifier | LiteralExpression;
|
||||
body: ModuleBlock | ModuleDeclaration;
|
||||
body?: ModuleBlock | ModuleDeclaration;
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.ModuleBlock)
|
||||
|
||||
@@ -372,6 +372,11 @@ namespace ts {
|
||||
((<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral || isGlobalScopeAugmentation(<ModuleDeclaration>node));
|
||||
}
|
||||
|
||||
export function isShorthandAmbientModule(node: Node): boolean {
|
||||
// The only kind of module that can be missing a body is a shorthand ambient module.
|
||||
return node.kind === SyntaxKind.ModuleDeclaration && (!(<ModuleDeclaration>node).body);
|
||||
}
|
||||
|
||||
export function isBlockScopedContainerTopLevel(node: Node): boolean {
|
||||
return node.kind === SyntaxKind.SourceFile ||
|
||||
node.kind === SyntaxKind.ModuleDeclaration ||
|
||||
|
||||
@@ -188,7 +188,10 @@ namespace ts.NavigationBar {
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
let moduleDeclaration = <ModuleDeclaration>node;
|
||||
topLevelNodes.push(node);
|
||||
addTopLevelNodes((<Block>getInnermostModule(moduleDeclaration).body).statements, topLevelNodes);
|
||||
const inner = getInnermostModule(moduleDeclaration);
|
||||
if (inner.body) {
|
||||
addTopLevelNodes((<Block>inner.body).statements, topLevelNodes);
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
@@ -453,7 +456,8 @@ namespace ts.NavigationBar {
|
||||
function createModuleItem(node: ModuleDeclaration): NavigationBarItem {
|
||||
const moduleName = getModuleName(node);
|
||||
|
||||
const childItems = getItemsWorker(getChildNodes((<Block>getInnermostModule(node).body).statements), createChildItem);
|
||||
const body = <Block>getInnermostModule(node).body;
|
||||
const childItems = body ? getItemsWorker(getChildNodes(body.statements), createChildItem) : [];
|
||||
|
||||
return getNavigationBarItem(moduleName,
|
||||
ts.ScriptElementKind.moduleElement,
|
||||
@@ -611,7 +615,7 @@ namespace ts.NavigationBar {
|
||||
}
|
||||
|
||||
function getInnermostModule(node: ModuleDeclaration): ModuleDeclaration {
|
||||
while (node.body.kind === SyntaxKind.ModuleDeclaration) {
|
||||
while (node.body && node.body.kind === SyntaxKind.ModuleDeclaration) {
|
||||
node = <ModuleDeclaration>node.body;
|
||||
}
|
||||
|
||||
|
||||
@@ -414,7 +414,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// If this is left side of dotted module declaration, there is no doc comments associated with this node
|
||||
if (declaration.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>declaration).body.kind === SyntaxKind.ModuleDeclaration) {
|
||||
if (declaration.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>declaration).body && (<ModuleDeclaration>declaration).body.kind === SyntaxKind.ModuleDeclaration) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
//// [tests/cases/conformance/ambient/ambientShorthand.ts] ////
|
||||
|
||||
//// [declarations.d.ts]
|
||||
declare module "jquery"
|
||||
// Semicolon is optional
|
||||
declare module "fs";
|
||||
|
||||
//// [user.ts]
|
||||
///<reference path="declarations.d.ts"/>
|
||||
import foo, {bar} from "jquery";
|
||||
import * as baz from "fs";
|
||||
import boom = require("jquery");
|
||||
foo(bar, baz, boom);
|
||||
|
||||
|
||||
//// [user.js]
|
||||
"use strict";
|
||||
///<reference path="declarations.d.ts"/>
|
||||
var jquery_1 = require("jquery");
|
||||
var baz = require("fs");
|
||||
var boom = require("jquery");
|
||||
jquery_1["default"](jquery_1.bar, baz, boom);
|
||||
@@ -0,0 +1,24 @@
|
||||
=== tests/cases/conformance/ambient/user.ts ===
|
||||
///<reference path="declarations.d.ts"/>
|
||||
import foo, {bar} from "jquery";
|
||||
>foo : Symbol(foo, Decl(user.ts, 1, 6))
|
||||
>bar : Symbol(bar, Decl(user.ts, 1, 13))
|
||||
|
||||
import * as baz from "fs";
|
||||
>baz : Symbol(baz, Decl(user.ts, 2, 6))
|
||||
|
||||
import boom = require("jquery");
|
||||
>boom : Symbol(boom, Decl(user.ts, 2, 26))
|
||||
|
||||
foo(bar, baz, boom);
|
||||
>foo : Symbol(foo, Decl(user.ts, 1, 6))
|
||||
>bar : Symbol(bar, Decl(user.ts, 1, 13))
|
||||
>baz : Symbol(baz, Decl(user.ts, 2, 6))
|
||||
>boom : Symbol(boom, Decl(user.ts, 2, 26))
|
||||
|
||||
=== tests/cases/conformance/ambient/declarations.d.ts ===
|
||||
declare module "jquery"
|
||||
No type information for this code.// Semicolon is optional
|
||||
No type information for this code.declare module "fs";
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,25 @@
|
||||
=== tests/cases/conformance/ambient/user.ts ===
|
||||
///<reference path="declarations.d.ts"/>
|
||||
import foo, {bar} from "jquery";
|
||||
>foo : any
|
||||
>bar : any
|
||||
|
||||
import * as baz from "fs";
|
||||
>baz : any
|
||||
|
||||
import boom = require("jquery");
|
||||
>boom : any
|
||||
|
||||
foo(bar, baz, boom);
|
||||
>foo(bar, baz, boom) : any
|
||||
>foo : any
|
||||
>bar : any
|
||||
>baz : any
|
||||
>boom : any
|
||||
|
||||
=== tests/cases/conformance/ambient/declarations.d.ts ===
|
||||
declare module "jquery"
|
||||
No type information for this code.// Semicolon is optional
|
||||
No type information for this code.declare module "fs";
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,9 @@
|
||||
//// [ambientShorthand_declarationEmit.ts]
|
||||
declare module "foo";
|
||||
|
||||
|
||||
//// [ambientShorthand_declarationEmit.js]
|
||||
|
||||
|
||||
//// [ambientShorthand_declarationEmit.d.ts]
|
||||
declare module "foo";
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/conformance/ambient/ambientShorthand_declarationEmit.ts ===
|
||||
declare module "foo";
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/conformance/ambient/ambientShorthand_declarationEmit.ts ===
|
||||
declare module "foo";
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [tests/cases/conformance/ambient/ambientShorthand_duplicate.ts] ////
|
||||
|
||||
//// [declarations1.d.ts]
|
||||
declare module "foo";
|
||||
|
||||
//// [declarations2.d.ts]
|
||||
declare module "foo";
|
||||
|
||||
//// [user.ts]
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.ts" />
|
||||
import foo from "foo";
|
||||
|
||||
|
||||
//// [user.js]
|
||||
"use strict";
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/conformance/ambient/user.ts ===
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.ts" />
|
||||
import foo from "foo";
|
||||
>foo : Symbol(foo, Decl(user.ts, 2, 6))
|
||||
|
||||
=== tests/cases/conformance/ambient/declarations1.d.ts ===
|
||||
declare module "foo";
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/conformance/ambient/user.ts ===
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.ts" />
|
||||
import foo from "foo";
|
||||
>foo : any
|
||||
|
||||
=== tests/cases/conformance/ambient/declarations1.d.ts ===
|
||||
declare module "foo";
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/ambient/ambientShorthand_isImplicitAny.ts(1,16): error TS7005: Variable '"jquery"' implicitly has an 'any' type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/ambient/ambientShorthand_isImplicitAny.ts (1 errors) ====
|
||||
declare module "jquery";
|
||||
~~~~~~~~
|
||||
!!! error TS7005: Variable '"jquery"' implicitly has an 'any' type.
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [ambientShorthand_isImplicitAny.ts]
|
||||
declare module "jquery";
|
||||
|
||||
|
||||
//// [ambientShorthand_isImplicitAny.js]
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [tests/cases/conformance/ambient/ambientShorthand_merging.ts] ////
|
||||
|
||||
//// [declarations1.d.ts]
|
||||
declare module "foo";
|
||||
|
||||
//// [declarations2.d.ts]
|
||||
declare module "foo" {
|
||||
export const bar: number;
|
||||
}
|
||||
|
||||
//// [user.ts]
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.ts" />
|
||||
import foo, {bar} from "foo";
|
||||
|
||||
|
||||
//// [user.js]
|
||||
"use strict";
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/conformance/ambient/user.ts ===
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.ts" />
|
||||
import foo, {bar} from "foo";
|
||||
>foo : Symbol(foo, Decl(user.ts, 2, 6))
|
||||
>bar : Symbol(bar, Decl(user.ts, 2, 13))
|
||||
|
||||
=== tests/cases/conformance/ambient/declarations1.d.ts ===
|
||||
declare module "foo";
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/conformance/ambient/user.ts ===
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.ts" />
|
||||
import foo, {bar} from "foo";
|
||||
>foo : any
|
||||
>bar : any
|
||||
|
||||
=== tests/cases/conformance/ambient/declarations1.d.ts ===
|
||||
declare module "foo";
|
||||
No type information for this code.
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,30 @@
|
||||
//// [tests/cases/conformance/ambient/ambientShorthand_reExport.ts] ////
|
||||
|
||||
//// [declarations.d.ts]
|
||||
declare module "jquery";
|
||||
|
||||
//// [reExportX.ts]
|
||||
export {x} from "jquery";
|
||||
|
||||
//// [reExportAll.ts]
|
||||
export * from "jquery";
|
||||
|
||||
//// [reExportUser.ts]
|
||||
import {x} from "./reExportX";
|
||||
import * as $ from "./reExportAll";
|
||||
// '$' is not callable, it is an object.
|
||||
x($);
|
||||
|
||||
|
||||
//// [reExportX.js]
|
||||
"use strict";
|
||||
var jquery_1 = require("jquery");
|
||||
exports.x = jquery_1.x;
|
||||
//// [reExportAll.js]
|
||||
"use strict";
|
||||
//// [reExportUser.js]
|
||||
"use strict";
|
||||
var reExportX_1 = require("./reExportX");
|
||||
var $ = require("./reExportAll");
|
||||
// '$' is not callable, it is an object.
|
||||
reExportX_1.x($);
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/conformance/ambient/declarations.d.ts ===
|
||||
declare module "jquery";
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/conformance/ambient/reExportX.ts ===
|
||||
export {x} from "jquery";
|
||||
>x : Symbol(x, Decl(reExportX.ts, 0, 8))
|
||||
|
||||
=== tests/cases/conformance/ambient/reExportAll.ts ===
|
||||
export * from "jquery";
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/conformance/ambient/reExportUser.ts ===
|
||||
import {x} from "./reExportX";
|
||||
>x : Symbol(x, Decl(reExportUser.ts, 0, 8))
|
||||
|
||||
import * as $ from "./reExportAll";
|
||||
>$ : Symbol($, Decl(reExportUser.ts, 1, 6))
|
||||
|
||||
// '$' is not callable, it is an object.
|
||||
x($);
|
||||
>x : Symbol(x, Decl(reExportUser.ts, 0, 8))
|
||||
>$ : Symbol($, Decl(reExportUser.ts, 1, 6))
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
=== tests/cases/conformance/ambient/declarations.d.ts ===
|
||||
declare module "jquery";
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/conformance/ambient/reExportX.ts ===
|
||||
export {x} from "jquery";
|
||||
>x : any
|
||||
|
||||
=== tests/cases/conformance/ambient/reExportAll.ts ===
|
||||
export * from "jquery";
|
||||
No type information for this code.
|
||||
No type information for this code.=== tests/cases/conformance/ambient/reExportUser.ts ===
|
||||
import {x} from "./reExportX";
|
||||
>x : any
|
||||
|
||||
import * as $ from "./reExportAll";
|
||||
>$ : typeof $
|
||||
|
||||
// '$' is not callable, it is an object.
|
||||
x($);
|
||||
>x($) : any
|
||||
>x : any
|
||||
>$ : typeof $
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
error TS1204: Cannot compile modules into 'es2015' when targeting 'ES5' or lower.
|
||||
|
||||
|
||||
!!! error TS1204: Cannot compile modules into 'es2015' when targeting 'ES5' or lower.
|
||||
==== tests/cases/compiler/es5andes6module.ts (0 errors) ====
|
||||
|
||||
export default class A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,4 +23,4 @@ var A = (function () {
|
||||
};
|
||||
return A;
|
||||
}());
|
||||
exports.default = A;
|
||||
export default A;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/compiler/es5andes6module.ts ===
|
||||
|
||||
export default class A
|
||||
>A : Symbol(A, Decl(es5andes6module.ts, 0, 0))
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
>B : Symbol(A.B, Decl(es5andes6module.ts, 6, 5))
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/es5andes6module.ts ===
|
||||
|
||||
export default class A
|
||||
>A : A
|
||||
{
|
||||
constructor ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public B()
|
||||
>B : () => number
|
||||
{
|
||||
return 42;
|
||||
>42 : number
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
//// [es6modulekindWithES5Target.ts]
|
||||
|
||||
export class C {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
export { C as C2 };
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export class D {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
export { D as D2 };
|
||||
|
||||
class E { }
|
||||
export {E};
|
||||
|
||||
|
||||
//// [es6modulekindWithES5Target.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;
|
||||
};
|
||||
export var C = (function () {
|
||||
function C() {
|
||||
this.p = 1;
|
||||
}
|
||||
C.prototype.method = function () { };
|
||||
C.s = 0;
|
||||
return C;
|
||||
}());
|
||||
export { C as C2 };
|
||||
export var D = (function () {
|
||||
function D() {
|
||||
this.p = 1;
|
||||
}
|
||||
D.prototype.method = function () { };
|
||||
D.s = 0;
|
||||
D = __decorate([
|
||||
foo
|
||||
], D);
|
||||
return D;
|
||||
}());
|
||||
export { D as D2 };
|
||||
var E = (function () {
|
||||
function E() {
|
||||
}
|
||||
return E;
|
||||
}());
|
||||
export { E };
|
||||
@@ -0,0 +1,47 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target.ts ===
|
||||
|
||||
export class C {
|
||||
>C : Symbol(C, Decl(es6modulekindWithES5Target.ts, 0, 0))
|
||||
|
||||
static s = 0;
|
||||
>s : Symbol(C.s, Decl(es6modulekindWithES5Target.ts, 1, 16))
|
||||
|
||||
p = 1;
|
||||
>p : Symbol(C.p, Decl(es6modulekindWithES5Target.ts, 2, 17))
|
||||
|
||||
method() { }
|
||||
>method : Symbol(C.method, Decl(es6modulekindWithES5Target.ts, 3, 10))
|
||||
}
|
||||
export { C as C2 };
|
||||
>C : Symbol(C2, Decl(es6modulekindWithES5Target.ts, 6, 8))
|
||||
>C2 : Symbol(C2, Decl(es6modulekindWithES5Target.ts, 6, 8))
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : Symbol(foo, Decl(es6modulekindWithES5Target.ts, 6, 19))
|
||||
>args : Symbol(args, Decl(es6modulekindWithES5Target.ts, 8, 21))
|
||||
|
||||
@foo
|
||||
>foo : Symbol(foo, Decl(es6modulekindWithES5Target.ts, 6, 19))
|
||||
|
||||
export class D {
|
||||
>D : Symbol(D, Decl(es6modulekindWithES5Target.ts, 8, 42))
|
||||
|
||||
static s = 0;
|
||||
>s : Symbol(D.s, Decl(es6modulekindWithES5Target.ts, 10, 16))
|
||||
|
||||
p = 1;
|
||||
>p : Symbol(D.p, Decl(es6modulekindWithES5Target.ts, 11, 17))
|
||||
|
||||
method() { }
|
||||
>method : Symbol(D.method, Decl(es6modulekindWithES5Target.ts, 12, 10))
|
||||
}
|
||||
export { D as D2 };
|
||||
>D : Symbol(D2, Decl(es6modulekindWithES5Target.ts, 15, 8))
|
||||
>D2 : Symbol(D2, Decl(es6modulekindWithES5Target.ts, 15, 8))
|
||||
|
||||
class E { }
|
||||
>E : Symbol(E, Decl(es6modulekindWithES5Target.ts, 15, 19))
|
||||
|
||||
export {E};
|
||||
>E : Symbol(E, Decl(es6modulekindWithES5Target.ts, 18, 8))
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target.ts ===
|
||||
|
||||
export class C {
|
||||
>C : C
|
||||
|
||||
static s = 0;
|
||||
>s : number
|
||||
>0 : number
|
||||
|
||||
p = 1;
|
||||
>p : number
|
||||
>1 : number
|
||||
|
||||
method() { }
|
||||
>method : () => void
|
||||
}
|
||||
export { C as C2 };
|
||||
>C : typeof C
|
||||
>C2 : typeof C
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : (...args: any[]) => any
|
||||
>args : any[]
|
||||
|
||||
@foo
|
||||
>foo : (...args: any[]) => any
|
||||
|
||||
export class D {
|
||||
>D : D
|
||||
|
||||
static s = 0;
|
||||
>s : number
|
||||
>0 : number
|
||||
|
||||
p = 1;
|
||||
>p : number
|
||||
>1 : number
|
||||
|
||||
method() { }
|
||||
>method : () => void
|
||||
}
|
||||
export { D as D2 };
|
||||
>D : typeof D
|
||||
>D2 : typeof D
|
||||
|
||||
class E { }
|
||||
>E : E
|
||||
|
||||
export {E};
|
||||
>E : typeof E
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
tests/cases/compiler/es6modulekindWithES5Target10.ts(2,1): error TS1202: Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
|
||||
tests/cases/compiler/es6modulekindWithES5Target10.ts(2,20): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/compiler/es6modulekindWithES5Target10.ts(7,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es6modulekindWithES5Target10.ts (3 errors) ====
|
||||
|
||||
import i = require("mod"); // Error;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1202: Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'mod'.
|
||||
|
||||
|
||||
namespace N {
|
||||
}
|
||||
export = N; // Error
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead.
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [es6modulekindWithES5Target10.ts]
|
||||
|
||||
import i = require("mod"); // Error;
|
||||
|
||||
|
||||
namespace N {
|
||||
}
|
||||
export = N; // Error
|
||||
|
||||
//// [es6modulekindWithES5Target10.js]
|
||||
@@ -0,0 +1,31 @@
|
||||
//// [es6modulekindWithES5Target11.ts]
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export default class C {
|
||||
static x() { return C.y; }
|
||||
static y = 1
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
|
||||
//// [es6modulekindWithES5Target11.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;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
this.p = 1;
|
||||
}
|
||||
C.x = function () { return C.y; };
|
||||
C.prototype.method = function () { };
|
||||
C.y = 1;
|
||||
C = __decorate([
|
||||
foo
|
||||
], C);
|
||||
return C;
|
||||
}());
|
||||
export default C;
|
||||
@@ -0,0 +1,27 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target11.ts ===
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : Symbol(foo, Decl(es6modulekindWithES5Target11.ts, 0, 0))
|
||||
>args : Symbol(args, Decl(es6modulekindWithES5Target11.ts, 1, 21))
|
||||
|
||||
@foo
|
||||
>foo : Symbol(foo, Decl(es6modulekindWithES5Target11.ts, 0, 0))
|
||||
|
||||
export default class C {
|
||||
>C : Symbol(C, Decl(es6modulekindWithES5Target11.ts, 1, 42))
|
||||
|
||||
static x() { return C.y; }
|
||||
>x : Symbol(C.x, Decl(es6modulekindWithES5Target11.ts, 3, 24))
|
||||
>C.y : Symbol(C.y, Decl(es6modulekindWithES5Target11.ts, 4, 30))
|
||||
>C : Symbol(C, Decl(es6modulekindWithES5Target11.ts, 1, 42))
|
||||
>y : Symbol(C.y, Decl(es6modulekindWithES5Target11.ts, 4, 30))
|
||||
|
||||
static y = 1
|
||||
>y : Symbol(C.y, Decl(es6modulekindWithES5Target11.ts, 4, 30))
|
||||
|
||||
p = 1;
|
||||
>p : Symbol(C.p, Decl(es6modulekindWithES5Target11.ts, 5, 16))
|
||||
|
||||
method() { }
|
||||
>method : Symbol(C.method, Decl(es6modulekindWithES5Target11.ts, 6, 10))
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target11.ts ===
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : (...args: any[]) => any
|
||||
>args : any[]
|
||||
|
||||
@foo
|
||||
>foo : (...args: any[]) => any
|
||||
|
||||
export default class C {
|
||||
>C : C
|
||||
|
||||
static x() { return C.y; }
|
||||
>x : () => number
|
||||
>C.y : number
|
||||
>C : typeof C
|
||||
>y : number
|
||||
|
||||
static y = 1
|
||||
>y : number
|
||||
>1 : number
|
||||
|
||||
p = 1;
|
||||
>p : number
|
||||
>1 : number
|
||||
|
||||
method() { }
|
||||
>method : () => void
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
//// [es6modulekindWithES5Target2.ts]
|
||||
|
||||
export default class C {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
|
||||
|
||||
//// [es6modulekindWithES5Target2.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
this.p = 1;
|
||||
}
|
||||
C.prototype.method = function () { };
|
||||
C.s = 0;
|
||||
return C;
|
||||
}());
|
||||
export default C;
|
||||
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target2.ts ===
|
||||
|
||||
export default class C {
|
||||
>C : Symbol(C, Decl(es6modulekindWithES5Target2.ts, 0, 0))
|
||||
|
||||
static s = 0;
|
||||
>s : Symbol(C.s, Decl(es6modulekindWithES5Target2.ts, 1, 24))
|
||||
|
||||
p = 1;
|
||||
>p : Symbol(C.p, Decl(es6modulekindWithES5Target2.ts, 2, 17))
|
||||
|
||||
method() { }
|
||||
>method : Symbol(C.method, Decl(es6modulekindWithES5Target2.ts, 3, 10))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target2.ts ===
|
||||
|
||||
export default class C {
|
||||
>C : C
|
||||
|
||||
static s = 0;
|
||||
>s : number
|
||||
>0 : number
|
||||
|
||||
p = 1;
|
||||
>p : number
|
||||
>1 : number
|
||||
|
||||
method() { }
|
||||
>method : () => void
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
//// [es6modulekindWithES5Target3.ts]
|
||||
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export default class D {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
|
||||
//// [es6modulekindWithES5Target3.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;
|
||||
};
|
||||
var D = (function () {
|
||||
function D() {
|
||||
this.p = 1;
|
||||
}
|
||||
D.prototype.method = function () { };
|
||||
D.s = 0;
|
||||
D = __decorate([
|
||||
foo
|
||||
], D);
|
||||
return D;
|
||||
}());
|
||||
export default D;
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target3.ts ===
|
||||
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : Symbol(foo, Decl(es6modulekindWithES5Target3.ts, 0, 0))
|
||||
>args : Symbol(args, Decl(es6modulekindWithES5Target3.ts, 2, 21))
|
||||
|
||||
@foo
|
||||
>foo : Symbol(foo, Decl(es6modulekindWithES5Target3.ts, 0, 0))
|
||||
|
||||
export default class D {
|
||||
>D : Symbol(D, Decl(es6modulekindWithES5Target3.ts, 2, 42))
|
||||
|
||||
static s = 0;
|
||||
>s : Symbol(D.s, Decl(es6modulekindWithES5Target3.ts, 4, 24))
|
||||
|
||||
p = 1;
|
||||
>p : Symbol(D.p, Decl(es6modulekindWithES5Target3.ts, 5, 17))
|
||||
|
||||
method() { }
|
||||
>method : Symbol(D.method, Decl(es6modulekindWithES5Target3.ts, 6, 10))
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target3.ts ===
|
||||
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
>foo : (...args: any[]) => any
|
||||
>args : any[]
|
||||
|
||||
@foo
|
||||
>foo : (...args: any[]) => any
|
||||
|
||||
export default class D {
|
||||
>D : D
|
||||
|
||||
static s = 0;
|
||||
>s : number
|
||||
>0 : number
|
||||
|
||||
p = 1;
|
||||
>p : number
|
||||
>1 : number
|
||||
|
||||
method() { }
|
||||
>method : () => void
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [es6modulekindWithES5Target4.ts]
|
||||
|
||||
class E { }
|
||||
export default E;
|
||||
|
||||
//// [es6modulekindWithES5Target4.js]
|
||||
var E = (function () {
|
||||
function E() {
|
||||
}
|
||||
return E;
|
||||
}());
|
||||
export default E;
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target4.ts ===
|
||||
|
||||
class E { }
|
||||
>E : Symbol(E, Decl(es6modulekindWithES5Target4.ts, 0, 0))
|
||||
|
||||
export default E;
|
||||
>E : Symbol(E, Decl(es6modulekindWithES5Target4.ts, 0, 0))
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target4.ts ===
|
||||
|
||||
class E { }
|
||||
>E : E
|
||||
|
||||
export default E;
|
||||
>E : E
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
//// [es6modulekindWithES5Target5.ts]
|
||||
|
||||
export enum E1 {
|
||||
value1
|
||||
}
|
||||
|
||||
export const enum E2 {
|
||||
value1
|
||||
}
|
||||
|
||||
//// [es6modulekindWithES5Target5.js]
|
||||
export var E1;
|
||||
(function (E1) {
|
||||
E1[E1["value1"] = 0] = "value1";
|
||||
})(E1 || (E1 = {}));
|
||||
export var E2;
|
||||
(function (E2) {
|
||||
E2[E2["value1"] = 0] = "value1";
|
||||
})(E2 || (E2 = {}));
|
||||
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target5.ts ===
|
||||
|
||||
export enum E1 {
|
||||
>E1 : Symbol(E1, Decl(es6modulekindWithES5Target5.ts, 0, 0))
|
||||
|
||||
value1
|
||||
>value1 : Symbol(E1.value1, Decl(es6modulekindWithES5Target5.ts, 1, 16))
|
||||
}
|
||||
|
||||
export const enum E2 {
|
||||
>E2 : Symbol(E2, Decl(es6modulekindWithES5Target5.ts, 3, 1))
|
||||
|
||||
value1
|
||||
>value1 : Symbol(E2.value1, Decl(es6modulekindWithES5Target5.ts, 5, 22))
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target5.ts ===
|
||||
|
||||
export enum E1 {
|
||||
>E1 : E1
|
||||
|
||||
value1
|
||||
>value1 : E1
|
||||
}
|
||||
|
||||
export const enum E2 {
|
||||
>E2 : E2
|
||||
|
||||
value1
|
||||
>value1 : E2
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//// [es6modulekindWithES5Target6.ts]
|
||||
|
||||
export function f1(d = 0) {
|
||||
}
|
||||
|
||||
export function f2(...arg) {
|
||||
}
|
||||
|
||||
export default function f3(d = 0) {
|
||||
}
|
||||
|
||||
|
||||
//// [es6modulekindWithES5Target6.js]
|
||||
export function f1(d) {
|
||||
if (d === void 0) { d = 0; }
|
||||
}
|
||||
export function f2() {
|
||||
var arg = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
arg[_i - 0] = arguments[_i];
|
||||
}
|
||||
}
|
||||
export default function f3(d) {
|
||||
if (d === void 0) { d = 0; }
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target6.ts ===
|
||||
|
||||
export function f1(d = 0) {
|
||||
>f1 : Symbol(f1, Decl(es6modulekindWithES5Target6.ts, 0, 0))
|
||||
>d : Symbol(d, Decl(es6modulekindWithES5Target6.ts, 1, 19))
|
||||
}
|
||||
|
||||
export function f2(...arg) {
|
||||
>f2 : Symbol(f2, Decl(es6modulekindWithES5Target6.ts, 2, 1))
|
||||
>arg : Symbol(arg, Decl(es6modulekindWithES5Target6.ts, 4, 19))
|
||||
}
|
||||
|
||||
export default function f3(d = 0) {
|
||||
>f3 : Symbol(f3, Decl(es6modulekindWithES5Target6.ts, 5, 1))
|
||||
>d : Symbol(d, Decl(es6modulekindWithES5Target6.ts, 7, 27))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target6.ts ===
|
||||
|
||||
export function f1(d = 0) {
|
||||
>f1 : (d?: number) => void
|
||||
>d : number
|
||||
>0 : number
|
||||
}
|
||||
|
||||
export function f2(...arg) {
|
||||
>f2 : (...arg: any[]) => void
|
||||
>arg : any[]
|
||||
}
|
||||
|
||||
export default function f3(d = 0) {
|
||||
>f3 : (d?: number) => void
|
||||
>d : number
|
||||
>0 : number
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [es6modulekindWithES5Target7.ts]
|
||||
|
||||
export namespace N {
|
||||
var x = 0;
|
||||
}
|
||||
|
||||
export namespace N2 {
|
||||
export interface I { }
|
||||
}
|
||||
|
||||
|
||||
//// [es6modulekindWithES5Target7.js]
|
||||
export var N;
|
||||
(function (N) {
|
||||
var x = 0;
|
||||
})(N || (N = {}));
|
||||
@@ -0,0 +1,16 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target7.ts ===
|
||||
|
||||
export namespace N {
|
||||
>N : Symbol(N, Decl(es6modulekindWithES5Target7.ts, 0, 0))
|
||||
|
||||
var x = 0;
|
||||
>x : Symbol(x, Decl(es6modulekindWithES5Target7.ts, 2, 7))
|
||||
}
|
||||
|
||||
export namespace N2 {
|
||||
>N2 : Symbol(N2, Decl(es6modulekindWithES5Target7.ts, 3, 1))
|
||||
|
||||
export interface I { }
|
||||
>I : Symbol(I, Decl(es6modulekindWithES5Target7.ts, 5, 21))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target7.ts ===
|
||||
|
||||
export namespace N {
|
||||
>N : typeof N
|
||||
|
||||
var x = 0;
|
||||
>x : number
|
||||
>0 : number
|
||||
}
|
||||
|
||||
export namespace N2 {
|
||||
>N2 : any
|
||||
|
||||
export interface I { }
|
||||
>I : I
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [es6modulekindWithES5Target8.ts]
|
||||
|
||||
export const c = 0;
|
||||
export let l = 1;
|
||||
|
||||
//// [es6modulekindWithES5Target8.js]
|
||||
export var c = 0;
|
||||
export var l = 1;
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target8.ts ===
|
||||
|
||||
export const c = 0;
|
||||
>c : Symbol(c, Decl(es6modulekindWithES5Target8.ts, 1, 12))
|
||||
|
||||
export let l = 1;
|
||||
>l : Symbol(l, Decl(es6modulekindWithES5Target8.ts, 2, 10))
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/es6modulekindWithES5Target8.ts ===
|
||||
|
||||
export const c = 0;
|
||||
>c : number
|
||||
>0 : number
|
||||
|
||||
export let l = 1;
|
||||
>l : number
|
||||
>1 : number
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
tests/cases/compiler/es6modulekindWithES5Target9.ts(2,15): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/compiler/es6modulekindWithES5Target9.ts(4,17): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/compiler/es6modulekindWithES5Target9.ts(6,20): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/compiler/es6modulekindWithES5Target9.ts(14,15): error TS2307: Cannot find module 'mod'.
|
||||
tests/cases/compiler/es6modulekindWithES5Target9.ts(16,17): error TS2307: Cannot find module 'mod'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/es6modulekindWithES5Target9.ts (5 errors) ====
|
||||
|
||||
import d from "mod";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'mod'.
|
||||
|
||||
import {a} from "mod";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'mod'.
|
||||
|
||||
import * as M from "mod";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'mod'.
|
||||
|
||||
export {a};
|
||||
|
||||
export {M};
|
||||
|
||||
export {d};
|
||||
|
||||
export * from "mod";
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'mod'.
|
||||
|
||||
export {b} from "mod"
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find module 'mod'.
|
||||
|
||||
export default d;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
//// [es6modulekindWithES5Target9.ts]
|
||||
|
||||
import d from "mod";
|
||||
|
||||
import {a} from "mod";
|
||||
|
||||
import * as M from "mod";
|
||||
|
||||
export {a};
|
||||
|
||||
export {M};
|
||||
|
||||
export {d};
|
||||
|
||||
export * from "mod";
|
||||
|
||||
export {b} from "mod"
|
||||
|
||||
export default d;
|
||||
|
||||
|
||||
//// [es6modulekindWithES5Target9.js]
|
||||
import d from "mod";
|
||||
import { a } from "mod";
|
||||
import * as M from "mod";
|
||||
export { a };
|
||||
export { M };
|
||||
export { d };
|
||||
export * from "mod";
|
||||
export { b } from "mod";
|
||||
export default d;
|
||||
@@ -1,8 +1,6 @@
|
||||
error TS1204: Cannot compile modules into 'es2015' when targeting 'ES5' or lower.
|
||||
tests/cases/compiler/test.ts(2,19): error TS2307: Cannot find module './foo'.
|
||||
|
||||
|
||||
!!! error TS1204: Cannot compile modules into 'es2015' when targeting 'ES5' or lower.
|
||||
==== tests/cases/compiler/test.ts (1 errors) ====
|
||||
|
||||
import {foo} from './foo';
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
// @experimentalDecorators: true
|
||||
|
||||
export class C {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
export { C as C2 };
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export class D {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
export { D as D2 };
|
||||
|
||||
class E { }
|
||||
export {E};
|
||||
@@ -0,0 +1,9 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
|
||||
import i = require("mod"); // Error;
|
||||
|
||||
|
||||
namespace N {
|
||||
}
|
||||
export = N; // Error
|
||||
@@ -0,0 +1,12 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
// @experimentalDecorators: true
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export default class C {
|
||||
static x() { return C.y; }
|
||||
static y = 1
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
|
||||
export default class C {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
// @experimentalDecorators: true
|
||||
|
||||
|
||||
declare function foo(...args: any[]): any;
|
||||
@foo
|
||||
export default class D {
|
||||
static s = 0;
|
||||
p = 1;
|
||||
method() { }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
|
||||
class E { }
|
||||
export default E;
|
||||
@@ -0,0 +1,11 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
// @preserveConstEnums: true
|
||||
|
||||
export enum E1 {
|
||||
value1
|
||||
}
|
||||
|
||||
export const enum E2 {
|
||||
value1
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
|
||||
export function f1(d = 0) {
|
||||
}
|
||||
|
||||
export function f2(...arg) {
|
||||
}
|
||||
|
||||
export default function f3(d = 0) {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
|
||||
export namespace N {
|
||||
var x = 0;
|
||||
}
|
||||
|
||||
export namespace N2 {
|
||||
export interface I { }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
|
||||
export const c = 0;
|
||||
export let l = 1;
|
||||
@@ -0,0 +1,20 @@
|
||||
// @target: es5
|
||||
// @module: es2015
|
||||
|
||||
import d from "mod";
|
||||
|
||||
import {a} from "mod";
|
||||
|
||||
import * as M from "mod";
|
||||
|
||||
export {a};
|
||||
|
||||
export {M};
|
||||
|
||||
export {d};
|
||||
|
||||
export * from "mod";
|
||||
|
||||
export {b} from "mod"
|
||||
|
||||
export default d;
|
||||
@@ -0,0 +1,11 @@
|
||||
// @Filename: declarations.d.ts
|
||||
declare module "jquery"
|
||||
// Semicolon is optional
|
||||
declare module "fs";
|
||||
|
||||
// @Filename: user.ts
|
||||
///<reference path="declarations.d.ts"/>
|
||||
import foo, {bar} from "jquery";
|
||||
import * as baz from "fs";
|
||||
import boom = require("jquery");
|
||||
foo(bar, baz, boom);
|
||||
@@ -0,0 +1,2 @@
|
||||
// @declaration: true
|
||||
declare module "foo";
|
||||
@@ -0,0 +1,10 @@
|
||||
// @Filename: declarations1.d.ts
|
||||
declare module "foo";
|
||||
|
||||
// @Filename: declarations2.d.ts
|
||||
declare module "foo";
|
||||
|
||||
// @Filename: user.ts
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.ts" />
|
||||
import foo from "foo";
|
||||
@@ -0,0 +1,2 @@
|
||||
// @noImplicitAny: true
|
||||
declare module "jquery";
|
||||
@@ -0,0 +1,12 @@
|
||||
// @Filename: declarations1.d.ts
|
||||
declare module "foo";
|
||||
|
||||
// @Filename: declarations2.d.ts
|
||||
declare module "foo" {
|
||||
export const bar: number;
|
||||
}
|
||||
|
||||
// @Filename: user.ts
|
||||
///<reference path="declarations1.d.ts" />
|
||||
///<reference path="declarations1.d.ts" />
|
||||
import foo, {bar} from "foo";
|
||||
@@ -0,0 +1,14 @@
|
||||
// @Filename: declarations.d.ts
|
||||
declare module "jquery";
|
||||
|
||||
// @Filename: reExportX.ts
|
||||
export {x} from "jquery";
|
||||
|
||||
// @Filename: reExportAll.ts
|
||||
export * from "jquery";
|
||||
|
||||
// @Filename: reExportUser.ts
|
||||
import {x} from "./reExportX";
|
||||
import * as $ from "./reExportAll";
|
||||
// '$' is not callable, it is an object.
|
||||
x($);
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: declarations.d.ts
|
||||
////declare module "jquery";
|
||||
|
||||
// @Filename: user.ts
|
||||
////import {[|x|]} from "jquery";
|
||||
|
||||
// @Filename: user2.ts
|
||||
////import {[|x|]} from "jquery";
|
||||
|
||||
let ranges = test.ranges();
|
||||
for (let range of ranges) {
|
||||
goTo.file(range.fileName);
|
||||
goTo.position(range.start);
|
||||
|
||||
verify.referencesCountIs(ranges.length);
|
||||
for (let expectedRange of ranges) {
|
||||
verify.referencesAtPositionContains(expectedRange);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: declarations.d.ts
|
||||
/////*module*/declare module "jquery"
|
||||
|
||||
// @Filename: user.ts
|
||||
///////<reference path="declarations.d.ts"/>
|
||||
////import /*importFoo*/foo, {bar} from "jquery";
|
||||
////import /*importBaz*/* as /*idBaz*/baz from "jquery";
|
||||
/////*importBang*/import /*idBang*/bang = require("jquery");
|
||||
////foo/*useFoo*/(bar/*useBar*/, baz/*useBaz*/, bang/*useBang*/);
|
||||
|
||||
goTo.marker("useFoo");
|
||||
verify.quickInfoIs("import foo");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("importFoo");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("module");
|
||||
|
||||
goTo.marker("useBar");
|
||||
verify.quickInfoIs("import bar");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("module");
|
||||
|
||||
goTo.marker("useBaz");
|
||||
verify.quickInfoIs("import baz");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("importBaz");
|
||||
goTo.marker("idBaz");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("module");
|
||||
|
||||
goTo.marker("useBang");
|
||||
verify.quickInfoIs("import bang = require(\"jquery\")");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("importBang");
|
||||
goTo.marker("idBang");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("module");
|
||||
Reference in New Issue
Block a user