Merge branch 'master' into wip-master-statelessOverload
This commit is contained in:
commit
989f9d82fd
22 changed files with 483 additions and 111 deletions
|
@ -50,7 +50,8 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
|
|||
r: "reporter",
|
||||
color: "colors",
|
||||
f: "files",
|
||||
file: "files"
|
||||
file: "files",
|
||||
w: "workers",
|
||||
},
|
||||
default: {
|
||||
soft: false,
|
||||
|
@ -63,6 +64,7 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
|
|||
reporter: process.env.reporter || process.env.r,
|
||||
lint: process.env.lint || true,
|
||||
files: process.env.f || process.env.file || process.env.files || "",
|
||||
workers: process.env.workerCount || os.cpus().length,
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -604,7 +606,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
|
|||
} while (fs.existsSync(taskConfigsFolder));
|
||||
fs.mkdirSync(taskConfigsFolder);
|
||||
|
||||
workerCount = process.env.workerCount || os.cpus().length;
|
||||
workerCount = cmdLineOptions["workers"];
|
||||
}
|
||||
|
||||
if (tests || light || taskConfigsFolder) {
|
||||
|
@ -1017,7 +1019,7 @@ gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are:
|
|||
cb();
|
||||
}, (cb) => {
|
||||
files = files.filter(file => fileMatcher.test(file.path)).sort((filea, fileb) => filea.stat.size - fileb.stat.size);
|
||||
const workerCount = (process.env.workerCount && +process.env.workerCount) || os.cpus().length;
|
||||
const workerCount = cmdLineOptions["workers"];
|
||||
for (let i = 0; i < workerCount; i++) {
|
||||
spawnLintWorker(files, finished);
|
||||
}
|
||||
|
|
|
@ -1514,7 +1514,7 @@ namespace ts {
|
|||
errorOnFirstToken(node, Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible);
|
||||
}
|
||||
if (isExternalModuleAugmentation(node)) {
|
||||
declareSymbolAndAddToSymbolTable(node, SymbolFlags.NamespaceModule, SymbolFlags.NamespaceModuleExcludes);
|
||||
declareModuleSymbol(node);
|
||||
}
|
||||
else {
|
||||
let pattern: Pattern | undefined;
|
||||
|
@ -1536,12 +1536,8 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
else {
|
||||
const state = getModuleInstanceState(node);
|
||||
if (state === ModuleInstanceState.NonInstantiated) {
|
||||
declareSymbolAndAddToSymbolTable(node, SymbolFlags.NamespaceModule, SymbolFlags.NamespaceModuleExcludes);
|
||||
}
|
||||
else {
|
||||
declareSymbolAndAddToSymbolTable(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes);
|
||||
const state = declareModuleSymbol(node);
|
||||
if (state !== ModuleInstanceState.NonInstantiated) {
|
||||
if (node.symbol.flags & (SymbolFlags.Function | SymbolFlags.Class | SymbolFlags.RegularEnum)) {
|
||||
// if module was already merged with some function, class or non-const enum
|
||||
// treat is a non-const-enum-only
|
||||
|
@ -1562,6 +1558,15 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
function declareModuleSymbol(node: ModuleDeclaration): ModuleInstanceState {
|
||||
const state = getModuleInstanceState(node);
|
||||
const instantiated = state !== ModuleInstanceState.NonInstantiated;
|
||||
declareSymbolAndAddToSymbolTable(node,
|
||||
instantiated ? SymbolFlags.ValueModule : SymbolFlags.NamespaceModule,
|
||||
instantiated ? SymbolFlags.ValueModuleExcludes : SymbolFlags.NamespaceModuleExcludes);
|
||||
return state;
|
||||
}
|
||||
|
||||
function bindFunctionOrConstructorType(node: SignatureDeclaration): void {
|
||||
// For a given function symbol "<...>(...) => T" we want to generate a symbol identical
|
||||
// to the one we would get for: { <...>(...): T }
|
||||
|
|
|
@ -486,6 +486,9 @@ namespace ts {
|
|||
}
|
||||
recordMergedSymbol(target, source);
|
||||
}
|
||||
else if (target.flags & SymbolFlags.NamespaceModule) {
|
||||
error(source.valueDeclaration.name, Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target));
|
||||
}
|
||||
else {
|
||||
const message = target.flags & SymbolFlags.BlockScopedVariable || source.flags & SymbolFlags.BlockScopedVariable
|
||||
? Diagnostics.Cannot_redeclare_block_scoped_variable_0 : Diagnostics.Duplicate_identifier_0;
|
||||
|
|
|
@ -1823,6 +1823,10 @@
|
|||
"category": "Error",
|
||||
"code": 2609
|
||||
},
|
||||
"Cannot augment module '{0}' with value exports because it resolves to a non-module entity.": {
|
||||
"category": "Error",
|
||||
"code": 2649
|
||||
},
|
||||
"Cannot emit namespaced JSX elements in React": {
|
||||
"category": "Error",
|
||||
"code": 2650
|
||||
|
|
|
@ -2316,7 +2316,7 @@ namespace ts {
|
|||
addRange(statements, convertedLoopBodyStatements);
|
||||
}
|
||||
else {
|
||||
const statement = visitNode(node.statement, visitor, isStatement);
|
||||
const statement = visitNode(node.statement, visitor, isStatement, /*optional*/ false, liftToBlock);
|
||||
if (isBlock(statement)) {
|
||||
addRange(statements, statement.statements);
|
||||
bodyLocation = statement;
|
||||
|
|
|
@ -484,18 +484,20 @@ namespace ts.server {
|
|||
|
||||
private getImplementation(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): protocol.FileSpan[] | ImplementationLocation[] {
|
||||
const { file, project } = this.getFileAndProject(args);
|
||||
const scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
||||
const position = this.getPosition(args, scriptInfo);
|
||||
const position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file));
|
||||
const implementations = project.getLanguageService().getImplementationAtPosition(file, position);
|
||||
if (!implementations) {
|
||||
return [];
|
||||
}
|
||||
if (simplifiedResult) {
|
||||
return implementations.map(impl => ({
|
||||
file: impl.fileName,
|
||||
start: scriptInfo.positionToLineOffset(impl.textSpan.start),
|
||||
end: scriptInfo.positionToLineOffset(ts.textSpanEnd(impl.textSpan))
|
||||
}));
|
||||
return implementations.map(({ fileName, textSpan }) => {
|
||||
const scriptInfo = project.getScriptInfo(fileName);
|
||||
return {
|
||||
file: fileName,
|
||||
start: scriptInfo.positionToLineOffset(textSpan.start),
|
||||
end: scriptInfo.positionToLineOffset(ts.textSpanEnd(textSpan))
|
||||
};
|
||||
});
|
||||
}
|
||||
else {
|
||||
return implementations;
|
||||
|
|
|
@ -220,7 +220,15 @@ namespace ts.GoToDefinition {
|
|||
}
|
||||
|
||||
function isSignatureDeclaration(node: Node): boolean {
|
||||
return node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature
|
||||
switch (node.kind) {
|
||||
case ts.SyntaxKind.Constructor:
|
||||
case ts.SyntaxKind.FunctionDeclaration:
|
||||
case ts.SyntaxKind.MethodDeclaration:
|
||||
case ts.SyntaxKind.MethodSignature:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */
|
||||
|
@ -287,11 +295,16 @@ namespace ts.GoToDefinition {
|
|||
|
||||
function tryGetSignatureDeclaration(typeChecker: TypeChecker, node: Node): SignatureDeclaration | undefined {
|
||||
const callLike = getAncestorCallLikeExpression(node);
|
||||
if (callLike) {
|
||||
const resolvedSignature = typeChecker.getResolvedSignature(callLike);
|
||||
const signature = callLike && typeChecker.getResolvedSignature(callLike);
|
||||
if (signature) {
|
||||
const decl = signature.declaration;
|
||||
// We have to check that resolvedSignature is not undefined because in the case of JSX opening-like element,
|
||||
// it may not be a stateless function component which then will cause getResolvedSignature to return undefined.
|
||||
return resolvedSignature && resolvedSignature.declaration;
|
||||
if (decl && isSignatureDeclaration(decl)) {
|
||||
return decl;
|
||||
}
|
||||
}
|
||||
// Don't go to a function type, go to the value having that type.
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,98 +1,92 @@
|
|||
/* @internal */
|
||||
namespace ts.Rename {
|
||||
export function getRenameInfo(typeChecker: TypeChecker, defaultLibFileName: string, getCanonicalFileName: (fileName: string) => string, sourceFile: SourceFile, position: number): RenameInfo {
|
||||
const canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName));
|
||||
|
||||
const getCanonicalDefaultLibName = memoize(() => getCanonicalFileName(ts.normalizePath(defaultLibFileName)));
|
||||
const node = getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true);
|
||||
|
||||
if (node) {
|
||||
if (node.kind === SyntaxKind.Identifier ||
|
||||
node.kind === SyntaxKind.StringLiteral ||
|
||||
isLiteralNameOfPropertyDeclarationOrIndexAccess(node) ||
|
||||
isThis(node)) {
|
||||
const symbol = typeChecker.getSymbolAtLocation(node);
|
||||
|
||||
// Only allow a symbol to be renamed if it actually has at least one declaration.
|
||||
if (symbol) {
|
||||
const declarations = symbol.getDeclarations();
|
||||
if (declarations && declarations.length > 0) {
|
||||
// Disallow rename for elements that are defined in the standard TypeScript library.
|
||||
if (forEach(declarations, isDefinedInLibraryFile)) {
|
||||
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library));
|
||||
}
|
||||
|
||||
const displayName = stripQuotes(getDeclaredName(typeChecker, symbol, node));
|
||||
const kind = SymbolDisplay.getSymbolKind(typeChecker, symbol, node);
|
||||
if (kind) {
|
||||
return {
|
||||
canRename: true,
|
||||
kind,
|
||||
displayName,
|
||||
localizedErrorMessage: undefined,
|
||||
fullDisplayName: typeChecker.getFullyQualifiedName(symbol),
|
||||
kindModifiers: SymbolDisplay.getSymbolModifiers(symbol),
|
||||
triggerSpan: createTriggerSpanForNode(node, sourceFile)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (node.kind === SyntaxKind.StringLiteral) {
|
||||
const type = getStringLiteralTypeForNode(<StringLiteral>node, typeChecker);
|
||||
if (type) {
|
||||
if (isDefinedInLibraryFile(node)) {
|
||||
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library));
|
||||
}
|
||||
else {
|
||||
const displayName = stripQuotes(type.text);
|
||||
return {
|
||||
canRename: true,
|
||||
kind: ScriptElementKind.variableElement,
|
||||
displayName,
|
||||
localizedErrorMessage: undefined,
|
||||
fullDisplayName: displayName,
|
||||
kindModifiers: ScriptElementKindModifier.none,
|
||||
triggerSpan: createTriggerSpanForNode(node, sourceFile)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element));
|
||||
|
||||
function getRenameInfoError(localizedErrorMessage: string): RenameInfo {
|
||||
return {
|
||||
canRename: false,
|
||||
localizedErrorMessage: localizedErrorMessage,
|
||||
displayName: undefined,
|
||||
fullDisplayName: undefined,
|
||||
kind: undefined,
|
||||
kindModifiers: undefined,
|
||||
triggerSpan: undefined
|
||||
};
|
||||
}
|
||||
const renameInfo = node && nodeIsEligibleForRename(node)
|
||||
? getRenameInfoForNode(node, typeChecker, sourceFile, isDefinedInLibraryFile)
|
||||
: undefined;
|
||||
return renameInfo || getRenameInfoError(Diagnostics.You_cannot_rename_this_element);
|
||||
|
||||
function isDefinedInLibraryFile(declaration: Node) {
|
||||
if (defaultLibFileName) {
|
||||
const sourceFile = declaration.getSourceFile();
|
||||
const canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName));
|
||||
if (canonicalName === canonicalDefaultLibName) {
|
||||
return true;
|
||||
}
|
||||
if (!defaultLibFileName) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function createTriggerSpanForNode(node: Node, sourceFile: SourceFile) {
|
||||
let start = node.getStart(sourceFile);
|
||||
let width = node.getWidth(sourceFile);
|
||||
if (node.kind === SyntaxKind.StringLiteral) {
|
||||
// Exclude the quotes
|
||||
start += 1;
|
||||
width -= 2;
|
||||
}
|
||||
return createTextSpan(start, width);
|
||||
const sourceFile = declaration.getSourceFile();
|
||||
const canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName));
|
||||
return canonicalName === getCanonicalDefaultLibName();
|
||||
}
|
||||
}
|
||||
|
||||
function getRenameInfoForNode(node: Node, typeChecker: TypeChecker, sourceFile: SourceFile, isDefinedInLibraryFile: (declaration: Node) => boolean): RenameInfo | undefined {
|
||||
const symbol = typeChecker.getSymbolAtLocation(node);
|
||||
|
||||
// Only allow a symbol to be renamed if it actually has at least one declaration.
|
||||
if (symbol) {
|
||||
const declarations = symbol.getDeclarations();
|
||||
if (declarations && declarations.length > 0) {
|
||||
// Disallow rename for elements that are defined in the standard TypeScript library.
|
||||
if (some(declarations, isDefinedInLibraryFile)) {
|
||||
return getRenameInfoError(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library);
|
||||
}
|
||||
|
||||
const displayName = stripQuotes(getDeclaredName(typeChecker, symbol, node));
|
||||
const kind = SymbolDisplay.getSymbolKind(typeChecker, symbol, node);
|
||||
return kind ? getRenameInfoSuccess(displayName, typeChecker.getFullyQualifiedName(symbol), kind, SymbolDisplay.getSymbolModifiers(symbol), node, sourceFile) : undefined;
|
||||
}
|
||||
}
|
||||
else if (node.kind === SyntaxKind.StringLiteral) {
|
||||
const type = getStringLiteralTypeForNode(<StringLiteral>node, typeChecker);
|
||||
if (type) {
|
||||
if (isDefinedInLibraryFile(node)) {
|
||||
return getRenameInfoError(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library);
|
||||
}
|
||||
|
||||
const displayName = stripQuotes(type.text);
|
||||
return getRenameInfoSuccess(displayName, displayName, ScriptElementKind.variableElement, ScriptElementKindModifier.none, node, sourceFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getRenameInfoSuccess(displayName: string, fullDisplayName: string, kind: string, kindModifiers: string, node: Node, sourceFile: SourceFile): RenameInfo {
|
||||
return {
|
||||
canRename: true,
|
||||
kind,
|
||||
displayName,
|
||||
localizedErrorMessage: undefined,
|
||||
fullDisplayName,
|
||||
kindModifiers,
|
||||
triggerSpan: createTriggerSpanForNode(node, sourceFile)
|
||||
};
|
||||
}
|
||||
|
||||
function getRenameInfoError(diagnostic: DiagnosticMessage): RenameInfo {
|
||||
return {
|
||||
canRename: false,
|
||||
localizedErrorMessage: getLocaleSpecificMessage(diagnostic),
|
||||
displayName: undefined,
|
||||
fullDisplayName: undefined,
|
||||
kind: undefined,
|
||||
kindModifiers: undefined,
|
||||
triggerSpan: undefined
|
||||
};
|
||||
}
|
||||
|
||||
function createTriggerSpanForNode(node: Node, sourceFile: SourceFile) {
|
||||
let start = node.getStart(sourceFile);
|
||||
let width = node.getWidth(sourceFile);
|
||||
if (node.kind === SyntaxKind.StringLiteral) {
|
||||
// Exclude the quotes
|
||||
start += 1;
|
||||
width -= 2;
|
||||
}
|
||||
return createTextSpan(start, width);
|
||||
}
|
||||
|
||||
function nodeIsEligibleForRename(node: Node) {
|
||||
return node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.StringLiteral ||
|
||||
isLiteralNameOfPropertyDeclarationOrIndexAccess(node) ||
|
||||
isThis(node);
|
||||
}
|
||||
}
|
||||
|
|
16
tests/baselines/reference/augmentExportEquals7.errors.txt
Normal file
16
tests/baselines/reference/augmentExportEquals7.errors.txt
Normal file
|
@ -0,0 +1,16 @@
|
|||
/node_modules/@types/lib-extender/index.d.ts(2,16): error TS2649: Cannot augment module 'lib' with value exports because it resolves to a non-module entity.
|
||||
|
||||
|
||||
==== /node_modules/lib/index.d.ts (0 errors) ====
|
||||
declare var lib: () => void;
|
||||
declare namespace lib {}
|
||||
export = lib;
|
||||
|
||||
==== /node_modules/@types/lib-extender/index.d.ts (1 errors) ====
|
||||
import * as lib from "lib";
|
||||
declare module "lib" {
|
||||
~~~~~
|
||||
!!! error TS2649: Cannot augment module 'lib' with value exports because it resolves to a non-module entity.
|
||||
export function fn(): void;
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
export { };
|
||||
|
||||
declare global {
|
||||
>global : any
|
||||
>global : typeof global
|
||||
|
||||
var x: number;
|
||||
>x : number
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
//// [nestedLoopWithOnlyInnerLetCaptured.ts]
|
||||
declare let doSomething;
|
||||
|
||||
for (let a1 of [])
|
||||
for (let a2 of a1.someArray)
|
||||
doSomething(() => a2);
|
||||
|
||||
//// [nestedLoopWithOnlyInnerLetCaptured.js]
|
||||
for (var _i = 0, _a = []; _i < _a.length; _i++) {
|
||||
var a1 = _a[_i];
|
||||
var _loop_1 = function (a2) {
|
||||
doSomething(function () { return a2; });
|
||||
};
|
||||
for (var _b = 0, _c = a1.someArray; _b < _c.length; _b++) {
|
||||
var a2 = _c[_b];
|
||||
_loop_1(a2);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
=== tests/cases/compiler/nestedLoopWithOnlyInnerLetCaptured.ts ===
|
||||
declare let doSomething;
|
||||
>doSomething : Symbol(doSomething, Decl(nestedLoopWithOnlyInnerLetCaptured.ts, 0, 11))
|
||||
|
||||
for (let a1 of [])
|
||||
>a1 : Symbol(a1, Decl(nestedLoopWithOnlyInnerLetCaptured.ts, 2, 8))
|
||||
|
||||
for (let a2 of a1.someArray)
|
||||
>a2 : Symbol(a2, Decl(nestedLoopWithOnlyInnerLetCaptured.ts, 3, 12))
|
||||
>a1 : Symbol(a1, Decl(nestedLoopWithOnlyInnerLetCaptured.ts, 2, 8))
|
||||
|
||||
doSomething(() => a2);
|
||||
>doSomething : Symbol(doSomething, Decl(nestedLoopWithOnlyInnerLetCaptured.ts, 0, 11))
|
||||
>a2 : Symbol(a2, Decl(nestedLoopWithOnlyInnerLetCaptured.ts, 3, 12))
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
=== tests/cases/compiler/nestedLoopWithOnlyInnerLetCaptured.ts ===
|
||||
declare let doSomething;
|
||||
>doSomething : any
|
||||
|
||||
for (let a1 of [])
|
||||
>a1 : any
|
||||
>[] : undefined[]
|
||||
|
||||
for (let a2 of a1.someArray)
|
||||
>a2 : any
|
||||
>a1.someArray : any
|
||||
>a1 : any
|
||||
>someArray : any
|
||||
|
||||
doSomething(() => a2);
|
||||
>doSomething(() => a2) : any
|
||||
>doSomething : any
|
||||
>() => a2 : () => any
|
||||
>a2 : any
|
||||
|
48
tests/baselines/reference/reactImportDropped.js
Normal file
48
tests/baselines/reference/reactImportDropped.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
//// [tests/cases/compiler/reactImportDropped.ts] ////
|
||||
|
||||
//// [react.d.ts]
|
||||
|
||||
export = React;
|
||||
export as namespace React;
|
||||
|
||||
declare namespace React {
|
||||
|
||||
function createClass(spec: any): ClassicComponentClass;
|
||||
|
||||
interface ClassicComponentClass {
|
||||
new (props?: any): ClassicComponentClass;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
namespace JSX {
|
||||
interface ElementAttributesProperty { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [TabBar.js]
|
||||
export default React.createClass({
|
||||
render() {
|
||||
return (
|
||||
null
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
//// [NavigationView.js]
|
||||
import TabBar from '../../components/TabBar';
|
||||
import {layout} from '../../utils/theme'; // <- DO NOT DROP this import
|
||||
const x = <TabBar height={layout.footerHeight} />;
|
||||
|
||||
|
||||
//// [TabBar.js]
|
||||
export default React.createClass({
|
||||
render() {
|
||||
return (null);
|
||||
}
|
||||
});
|
||||
//// [NavigationView.js]
|
||||
import TabBar from '../../components/TabBar';
|
||||
import { layout } from '../../utils/theme'; // <- DO NOT DROP this import
|
||||
const x = React.createElement(TabBar, { height: layout.footerHeight });
|
65
tests/baselines/reference/reactImportDropped.symbols
Normal file
65
tests/baselines/reference/reactImportDropped.symbols
Normal file
|
@ -0,0 +1,65 @@
|
|||
=== tests/cases/compiler/react.d.ts ===
|
||||
|
||||
export = React;
|
||||
>React : Symbol(React, Decl(react.d.ts, 2, 26))
|
||||
|
||||
export as namespace React;
|
||||
>React : Symbol(React, Decl(react.d.ts, 1, 15))
|
||||
|
||||
declare namespace React {
|
||||
>React : Symbol(React, Decl(react.d.ts, 2, 26))
|
||||
|
||||
function createClass(spec: any): ClassicComponentClass;
|
||||
>createClass : Symbol(createClass, Decl(react.d.ts, 4, 25))
|
||||
>spec : Symbol(spec, Decl(react.d.ts, 6, 25))
|
||||
>ClassicComponentClass : Symbol(ClassicComponentClass, Decl(react.d.ts, 6, 59))
|
||||
|
||||
interface ClassicComponentClass {
|
||||
>ClassicComponentClass : Symbol(ClassicComponentClass, Decl(react.d.ts, 6, 59))
|
||||
|
||||
new (props?: any): ClassicComponentClass;
|
||||
>props : Symbol(props, Decl(react.d.ts, 9, 13))
|
||||
>ClassicComponentClass : Symbol(ClassicComponentClass, Decl(react.d.ts, 6, 59))
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
>global : Symbol(global, Decl(react.d.ts, 11, 1))
|
||||
|
||||
namespace JSX {
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 13, 16))
|
||||
|
||||
interface ElementAttributesProperty { }
|
||||
>ElementAttributesProperty : Symbol(ElementAttributesProperty, Decl(react.d.ts, 14, 19))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
=== tests/cases/compiler/src/components/TabBar.js ===
|
||||
export default React.createClass({
|
||||
>React.createClass : Symbol(React.createClass, Decl(react.d.ts, 4, 25))
|
||||
>React : Symbol(React, Decl(react.d.ts, 1, 15))
|
||||
>createClass : Symbol(React.createClass, Decl(react.d.ts, 4, 25))
|
||||
|
||||
render() {
|
||||
>render : Symbol(render, Decl(TabBar.js, 0, 34))
|
||||
|
||||
return (
|
||||
null
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
=== tests/cases/compiler/src/modules/navigation/NavigationView.js ===
|
||||
import TabBar from '../../components/TabBar';
|
||||
>TabBar : Symbol(TabBar, Decl(NavigationView.js, 0, 6))
|
||||
|
||||
import {layout} from '../../utils/theme'; // <- DO NOT DROP this import
|
||||
>layout : Symbol(layout, Decl(NavigationView.js, 1, 8))
|
||||
|
||||
const x = <TabBar height={layout.footerHeight} />;
|
||||
>x : Symbol(x, Decl(NavigationView.js, 2, 5))
|
||||
>TabBar : Symbol(TabBar, Decl(NavigationView.js, 0, 6))
|
||||
>height : Symbol(layout)
|
||||
>layout : Symbol(layout, Decl(NavigationView.js, 1, 8))
|
||||
|
74
tests/baselines/reference/reactImportDropped.types
Normal file
74
tests/baselines/reference/reactImportDropped.types
Normal file
|
@ -0,0 +1,74 @@
|
|||
=== tests/cases/compiler/react.d.ts ===
|
||||
|
||||
export = React;
|
||||
>React : typeof React
|
||||
|
||||
export as namespace React;
|
||||
>React : typeof React
|
||||
|
||||
declare namespace React {
|
||||
>React : typeof React
|
||||
|
||||
function createClass(spec: any): ClassicComponentClass;
|
||||
>createClass : (spec: any) => ClassicComponentClass
|
||||
>spec : any
|
||||
>ClassicComponentClass : ClassicComponentClass
|
||||
|
||||
interface ClassicComponentClass {
|
||||
>ClassicComponentClass : ClassicComponentClass
|
||||
|
||||
new (props?: any): ClassicComponentClass;
|
||||
>props : any
|
||||
>ClassicComponentClass : ClassicComponentClass
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
>global : any
|
||||
|
||||
namespace JSX {
|
||||
>JSX : any
|
||||
|
||||
interface ElementAttributesProperty { }
|
||||
>ElementAttributesProperty : ElementAttributesProperty
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
=== tests/cases/compiler/src/components/TabBar.js ===
|
||||
export default React.createClass({
|
||||
>React.createClass({ render() { return ( null ); }}) : React.ClassicComponentClass
|
||||
>React.createClass : (spec: any) => React.ClassicComponentClass
|
||||
>React : typeof React
|
||||
>createClass : (spec: any) => React.ClassicComponentClass
|
||||
>{ render() { return ( null ); }} : { render(): any; }
|
||||
|
||||
render() {
|
||||
>render : () => any
|
||||
|
||||
return (
|
||||
>( null ) : null
|
||||
|
||||
null
|
||||
>null : null
|
||||
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
=== tests/cases/compiler/src/modules/navigation/NavigationView.js ===
|
||||
import TabBar from '../../components/TabBar';
|
||||
>TabBar : React.ClassicComponentClass
|
||||
|
||||
import {layout} from '../../utils/theme'; // <- DO NOT DROP this import
|
||||
>layout : any
|
||||
|
||||
const x = <TabBar height={layout.footerHeight} />;
|
||||
>x : any
|
||||
><TabBar height={layout.footerHeight} /> : any
|
||||
>TabBar : React.ClassicComponentClass
|
||||
>height : any
|
||||
>layout.footerHeight : any
|
||||
>layout : any
|
||||
>footerHeight : any
|
||||
|
10
tests/cases/compiler/augmentExportEquals7.ts
Normal file
10
tests/cases/compiler/augmentExportEquals7.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
// @Filename: /node_modules/lib/index.d.ts
|
||||
declare var lib: () => void;
|
||||
declare namespace lib {}
|
||||
export = lib;
|
||||
|
||||
// @Filename: /node_modules/@types/lib-extender/index.d.ts
|
||||
import * as lib from "lib";
|
||||
declare module "lib" {
|
||||
export function fn(): void;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
// @target: es5
|
||||
declare let doSomething;
|
||||
|
||||
for (let a1 of [])
|
||||
for (let a2 of a1.someArray)
|
||||
doSomething(() => a2);
|
42
tests/cases/compiler/reactImportDropped.ts
Normal file
42
tests/cases/compiler/reactImportDropped.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
//@module: es6
|
||||
//@moduleResolution: node
|
||||
//@target: es6
|
||||
//@noImplicitAny: false
|
||||
//@allowSyntheticDefaultImports: true
|
||||
//@allowJs: true
|
||||
//@jsx: react
|
||||
//@outDir: "build"
|
||||
|
||||
//@filename: react.d.ts
|
||||
export = React;
|
||||
export as namespace React;
|
||||
|
||||
declare namespace React {
|
||||
|
||||
function createClass(spec: any): ClassicComponentClass;
|
||||
|
||||
interface ClassicComponentClass {
|
||||
new (props?: any): ClassicComponentClass;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
namespace JSX {
|
||||
interface ElementAttributesProperty { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//@filename: src/components/TabBar.js
|
||||
export default React.createClass({
|
||||
render() {
|
||||
return (
|
||||
null
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
//@filename: src/modules/navigation/NavigationView.js
|
||||
import TabBar from '../../components/TabBar';
|
||||
import {layout} from '../../utils/theme'; // <- DO NOT DROP this import
|
||||
const x = <TabBar height={layout.footerHeight} />;
|
17
tests/cases/fourslash/goToDefinitionFunctionType.ts
Normal file
17
tests/cases/fourslash/goToDefinitionFunctionType.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// Tests that goToDefinition does not go to a function type; it goes to the value.
|
||||
|
||||
////const /*constDefinition*/c: () => void;
|
||||
/////*constReference*/c();
|
||||
////function test(/*cbDefinition*/cb: () => void) {
|
||||
//// /*cbReference*/cb();
|
||||
////}
|
||||
////class C {
|
||||
//// /*propDefinition*/prop: () => void;
|
||||
//// m() {
|
||||
//// this./*propReference*/prop();
|
||||
//// }
|
||||
////}
|
||||
|
||||
verify.goToDefinitionForMarkers("const", "cb", "prop");
|
|
@ -0,0 +1,19 @@
|
|||
/// <reference path='../fourslash.ts'/>
|
||||
|
||||
// @Filename: /bar.ts
|
||||
////import {Foo} from './foo'
|
||||
////
|
||||
////[|class A implements Foo {
|
||||
//// func() {}
|
||||
////}|]
|
||||
////
|
||||
////[|class B implements Foo {
|
||||
//// func() {}
|
||||
////}|]
|
||||
|
||||
// @Filename: /foo.ts
|
||||
////export interface /**/Foo {
|
||||
//// func();
|
||||
////}
|
||||
|
||||
verify.allRangesAppearInImplementationList("");
|
|
@ -315,7 +315,6 @@ if (browser === "chrome") {
|
|||
let defaultChromePath = "";
|
||||
switch (os.platform()) {
|
||||
case "win32":
|
||||
case "win64":
|
||||
defaultChromePath = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe";
|
||||
break;
|
||||
case "darwin":
|
||||
|
|
Loading…
Reference in a new issue