mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into getOccurrences
This commit is contained in:
Vendored
+57
-52
@@ -3807,30 +3807,42 @@ declare var Window: {
|
||||
new(): Window;
|
||||
}
|
||||
|
||||
interface FormData {
|
||||
append(name: any, value: any, blobName?: string): void;
|
||||
interface HTMLCollection extends MSHTMLCollectionExtensions {
|
||||
/**
|
||||
* Sets or retrieves the number of objects in a collection.
|
||||
*/
|
||||
length: number;
|
||||
/**
|
||||
* Retrieves an object from various collections.
|
||||
*/
|
||||
item(nameOrIndex?: any, optionalIndex?: any): Element;
|
||||
/**
|
||||
* Retrieves a select object or an object from an options collection.
|
||||
*/
|
||||
namedItem(name: string): Element;
|
||||
// [name: string]: Element;
|
||||
[index: number]: Element;
|
||||
}
|
||||
declare var FormData: {
|
||||
prototype: FormData;
|
||||
new (form?: HTMLFormElement): FormData;
|
||||
declare var HTMLCollection: {
|
||||
prototype: HTMLCollection;
|
||||
new(): HTMLCollection;
|
||||
}
|
||||
|
||||
interface SourceBuffer extends EventTarget {
|
||||
updating: boolean;
|
||||
appendWindowStart: number;
|
||||
appendWindowEnd: number;
|
||||
buffered: TimeRanges;
|
||||
timestampOffset: number;
|
||||
audioTracks: AudioTrackList;
|
||||
appendBuffer(data: ArrayBufferView): void;
|
||||
appendBuffer(data: ArrayBuffer): void;
|
||||
remove(start: number, end: number): void;
|
||||
abort(): void;
|
||||
appendStream(stream: MSStream, maxSize?: number): void;
|
||||
interface BlobPropertyBag {
|
||||
type?: string;
|
||||
endings?: string;
|
||||
}
|
||||
declare var SourceBuffer: {
|
||||
prototype: SourceBuffer;
|
||||
new(): SourceBuffer;
|
||||
|
||||
interface Blob {
|
||||
type: string;
|
||||
size: number;
|
||||
msDetachStream(): any;
|
||||
slice(start?: number, end?: number, contentType?: string): Blob;
|
||||
msClose(): void;
|
||||
}
|
||||
declare var Blob: {
|
||||
prototype: Blob;
|
||||
new (blobParts?: any[], options?: BlobPropertyBag): Blob;
|
||||
}
|
||||
|
||||
interface NavigatorID {
|
||||
@@ -5739,26 +5751,6 @@ declare var MSCSSProperties: {
|
||||
new(): MSCSSProperties;
|
||||
}
|
||||
|
||||
interface HTMLCollection extends MSHTMLCollectionExtensions {
|
||||
/**
|
||||
* Sets or retrieves the number of objects in a collection.
|
||||
*/
|
||||
length: number;
|
||||
/**
|
||||
* Retrieves an object from various collections.
|
||||
*/
|
||||
item(nameOrIndex?: any, optionalIndex?: any): Element;
|
||||
/**
|
||||
* Retrieves a select object or an object from an options collection.
|
||||
*/
|
||||
namedItem(name: string): Element;
|
||||
// [name: string]: Element;
|
||||
}
|
||||
declare var HTMLCollection: {
|
||||
prototype: HTMLCollection;
|
||||
new(): HTMLCollection;
|
||||
}
|
||||
|
||||
interface SVGExternalResourcesRequired {
|
||||
externalResourcesRequired: SVGAnimatedBoolean;
|
||||
}
|
||||
@@ -11994,18 +11986,6 @@ declare var FileReader: {
|
||||
new(): FileReader;
|
||||
}
|
||||
|
||||
interface Blob {
|
||||
type: string;
|
||||
size: number;
|
||||
msDetachStream(): any;
|
||||
slice(start?: number, end?: number, contentType?: string): Blob;
|
||||
msClose(): void;
|
||||
}
|
||||
declare var Blob: {
|
||||
prototype: Blob;
|
||||
new(): Blob;
|
||||
}
|
||||
|
||||
interface ApplicationCache extends EventTarget {
|
||||
status: number;
|
||||
ondownloading: (ev: Event) => any;
|
||||
@@ -12164,6 +12144,14 @@ declare var MSManipulationEvent: {
|
||||
MS_MANIPULATION_STATE_CANCELLED: number;
|
||||
}
|
||||
|
||||
interface FormData {
|
||||
append(name: any, value: any, blobName?: string): void;
|
||||
}
|
||||
declare var FormData: {
|
||||
prototype: FormData;
|
||||
new(): FormData;
|
||||
}
|
||||
|
||||
interface HTMLDataListElement extends HTMLElement {
|
||||
options: HTMLCollection;
|
||||
}
|
||||
@@ -12582,6 +12570,23 @@ interface RandomSource {
|
||||
getRandomValues(array: ArrayBufferView): ArrayBufferView;
|
||||
}
|
||||
|
||||
interface SourceBuffer extends EventTarget {
|
||||
updating: boolean;
|
||||
appendWindowStart: number;
|
||||
appendWindowEnd: number;
|
||||
buffered: TimeRanges;
|
||||
timestampOffset: number;
|
||||
audioTracks: AudioTrackList;
|
||||
appendBuffer(data: ArrayBuffer): void;
|
||||
remove(start: number, end: number): void;
|
||||
abort(): void;
|
||||
appendStream(stream: MSStream, maxSize?: number): void;
|
||||
}
|
||||
declare var SourceBuffer: {
|
||||
prototype: SourceBuffer;
|
||||
new(): SourceBuffer;
|
||||
}
|
||||
|
||||
interface MSInputMethodContext extends EventTarget {
|
||||
oncandidatewindowshow: (ev: any) => any;
|
||||
target: HTMLElement;
|
||||
|
||||
Vendored
+57
-52
@@ -2704,30 +2704,42 @@ declare var Window: {
|
||||
new(): Window;
|
||||
}
|
||||
|
||||
interface FormData {
|
||||
append(name: any, value: any, blobName?: string): void;
|
||||
interface HTMLCollection extends MSHTMLCollectionExtensions {
|
||||
/**
|
||||
* Sets or retrieves the number of objects in a collection.
|
||||
*/
|
||||
length: number;
|
||||
/**
|
||||
* Retrieves an object from various collections.
|
||||
*/
|
||||
item(nameOrIndex?: any, optionalIndex?: any): Element;
|
||||
/**
|
||||
* Retrieves a select object or an object from an options collection.
|
||||
*/
|
||||
namedItem(name: string): Element;
|
||||
// [name: string]: Element;
|
||||
[index: number]: Element;
|
||||
}
|
||||
declare var FormData: {
|
||||
prototype: FormData;
|
||||
new (form?: HTMLFormElement): FormData;
|
||||
declare var HTMLCollection: {
|
||||
prototype: HTMLCollection;
|
||||
new(): HTMLCollection;
|
||||
}
|
||||
|
||||
interface SourceBuffer extends EventTarget {
|
||||
updating: boolean;
|
||||
appendWindowStart: number;
|
||||
appendWindowEnd: number;
|
||||
buffered: TimeRanges;
|
||||
timestampOffset: number;
|
||||
audioTracks: AudioTrackList;
|
||||
appendBuffer(data: ArrayBufferView): void;
|
||||
appendBuffer(data: ArrayBuffer): void;
|
||||
remove(start: number, end: number): void;
|
||||
abort(): void;
|
||||
appendStream(stream: MSStream, maxSize?: number): void;
|
||||
interface BlobPropertyBag {
|
||||
type?: string;
|
||||
endings?: string;
|
||||
}
|
||||
declare var SourceBuffer: {
|
||||
prototype: SourceBuffer;
|
||||
new(): SourceBuffer;
|
||||
|
||||
interface Blob {
|
||||
type: string;
|
||||
size: number;
|
||||
msDetachStream(): any;
|
||||
slice(start?: number, end?: number, contentType?: string): Blob;
|
||||
msClose(): void;
|
||||
}
|
||||
declare var Blob: {
|
||||
prototype: Blob;
|
||||
new (blobParts?: any[], options?: BlobPropertyBag): Blob;
|
||||
}
|
||||
|
||||
interface NavigatorID {
|
||||
@@ -4636,26 +4648,6 @@ declare var MSCSSProperties: {
|
||||
new(): MSCSSProperties;
|
||||
}
|
||||
|
||||
interface HTMLCollection extends MSHTMLCollectionExtensions {
|
||||
/**
|
||||
* Sets or retrieves the number of objects in a collection.
|
||||
*/
|
||||
length: number;
|
||||
/**
|
||||
* Retrieves an object from various collections.
|
||||
*/
|
||||
item(nameOrIndex?: any, optionalIndex?: any): Element;
|
||||
/**
|
||||
* Retrieves a select object or an object from an options collection.
|
||||
*/
|
||||
namedItem(name: string): Element;
|
||||
// [name: string]: Element;
|
||||
}
|
||||
declare var HTMLCollection: {
|
||||
prototype: HTMLCollection;
|
||||
new(): HTMLCollection;
|
||||
}
|
||||
|
||||
interface SVGExternalResourcesRequired {
|
||||
externalResourcesRequired: SVGAnimatedBoolean;
|
||||
}
|
||||
@@ -10891,18 +10883,6 @@ declare var FileReader: {
|
||||
new(): FileReader;
|
||||
}
|
||||
|
||||
interface Blob {
|
||||
type: string;
|
||||
size: number;
|
||||
msDetachStream(): any;
|
||||
slice(start?: number, end?: number, contentType?: string): Blob;
|
||||
msClose(): void;
|
||||
}
|
||||
declare var Blob: {
|
||||
prototype: Blob;
|
||||
new(): Blob;
|
||||
}
|
||||
|
||||
interface ApplicationCache extends EventTarget {
|
||||
status: number;
|
||||
ondownloading: (ev: Event) => any;
|
||||
@@ -11061,6 +11041,14 @@ declare var MSManipulationEvent: {
|
||||
MS_MANIPULATION_STATE_CANCELLED: number;
|
||||
}
|
||||
|
||||
interface FormData {
|
||||
append(name: any, value: any, blobName?: string): void;
|
||||
}
|
||||
declare var FormData: {
|
||||
prototype: FormData;
|
||||
new(): FormData;
|
||||
}
|
||||
|
||||
interface HTMLDataListElement extends HTMLElement {
|
||||
options: HTMLCollection;
|
||||
}
|
||||
@@ -11479,6 +11467,23 @@ interface RandomSource {
|
||||
getRandomValues(array: ArrayBufferView): ArrayBufferView;
|
||||
}
|
||||
|
||||
interface SourceBuffer extends EventTarget {
|
||||
updating: boolean;
|
||||
appendWindowStart: number;
|
||||
appendWindowEnd: number;
|
||||
buffered: TimeRanges;
|
||||
timestampOffset: number;
|
||||
audioTracks: AudioTrackList;
|
||||
appendBuffer(data: ArrayBuffer): void;
|
||||
remove(start: number, end: number): void;
|
||||
abort(): void;
|
||||
appendStream(stream: MSStream, maxSize?: number): void;
|
||||
}
|
||||
declare var SourceBuffer: {
|
||||
prototype: SourceBuffer;
|
||||
new(): SourceBuffer;
|
||||
}
|
||||
|
||||
interface MSInputMethodContext extends EventTarget {
|
||||
oncandidatewindowshow: (ev: any) => any;
|
||||
target: HTMLElement;
|
||||
|
||||
Vendored
+6
-1
@@ -1453,6 +1453,11 @@ declare var FileReader: {
|
||||
new(): FileReader;
|
||||
}
|
||||
|
||||
interface BlobPropertyBag {
|
||||
type?: string;
|
||||
endings?: string;
|
||||
}
|
||||
|
||||
interface Blob {
|
||||
type: string;
|
||||
size: number;
|
||||
@@ -1462,7 +1467,7 @@ interface Blob {
|
||||
}
|
||||
declare var Blob: {
|
||||
prototype: Blob;
|
||||
new(): Blob;
|
||||
new (blobParts?: any[], options?: BlobPropertyBag): Blob;
|
||||
}
|
||||
|
||||
interface MSStream {
|
||||
|
||||
+398
-259
File diff suppressed because it is too large
Load Diff
+1140
-626
File diff suppressed because one or more lines are too long
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "1.0.1",
|
||||
"version": "1.1.0",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "Apache License 2.0",
|
||||
|
||||
@@ -33,44 +33,44 @@ function importDefinitelyTypedTest(testCaseName: string, testFiles: string[], re
|
||||
fs.mkdirSync(testDirectoryPath);
|
||||
|
||||
child_process.exec(cmd, {
|
||||
maxBuffer: 1 * 1024 * 1024,
|
||||
cwd: testDirectoryPath
|
||||
}, (error, stdout, stderr) => {
|
||||
//console.log("importing " + testCaseName + " ...");
|
||||
//console.log(cmd);
|
||||
|
||||
if (error) {
|
||||
console.log("importing " + testCaseName + " ...");
|
||||
console.log(cmd);
|
||||
console.log("==> error " + JSON.stringify(error));
|
||||
console.log("==> stdout " + String(stdout));
|
||||
console.log("==> stderr " + String(stderr));
|
||||
console.log("\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// copy generated file to output location
|
||||
var outputFilePath = path.join(testDirectoryPath, "iocapture0.json");
|
||||
var testCasePath = path.join(rwcTestPath, "DefinitelyTyped_" + testCaseName + ".json");
|
||||
copyFileSync(outputFilePath, testCasePath);
|
||||
|
||||
//console.log("output generated at: " + outputFilePath);
|
||||
|
||||
if (!fs.existsSync(testCasePath)) {
|
||||
throw new Error("could not find test case at: " + testCasePath);
|
||||
}
|
||||
else {
|
||||
fs.unlinkSync(outputFilePath);
|
||||
fs.rmdirSync(testDirectoryPath);
|
||||
//console.log("testcase generated at: " + testCasePath);
|
||||
//console.log("Done.");
|
||||
}
|
||||
//console.log("\r\n");
|
||||
|
||||
})
|
||||
.on('error', function (error) {
|
||||
console.log("==> error " + JSON.stringify(error));
|
||||
console.log("\r\n");
|
||||
maxBuffer: 1 * 1024 * 1024,
|
||||
cwd: testDirectoryPath
|
||||
}, (error, stdout, stderr) => {
|
||||
console.log("importing " + testCaseName + " ...");
|
||||
console.log(cmd);
|
||||
|
||||
if (error) {
|
||||
console.log("importing " + testCaseName + " ...");
|
||||
console.log(cmd);
|
||||
console.log("==> error " + JSON.stringify(error));
|
||||
console.log("==> stdout " + String(stdout));
|
||||
console.log("==> stderr " + String(stderr));
|
||||
console.log("\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// copy generated file to output location
|
||||
var outputFilePath = path.join(testDirectoryPath, "iocapture0.json");
|
||||
var testCasePath = path.join(rwcTestPath, "DefinitelyTyped_" + testCaseName + ".json");
|
||||
copyFileSync(outputFilePath, testCasePath);
|
||||
|
||||
//console.log("output generated at: " + outputFilePath);
|
||||
|
||||
if (!fs.existsSync(testCasePath)) {
|
||||
throw new Error("could not find test case at: " + testCasePath);
|
||||
}
|
||||
else {
|
||||
fs.unlinkSync(outputFilePath);
|
||||
fs.rmdirSync(testDirectoryPath);
|
||||
//console.log("testcase generated at: " + testCasePath);
|
||||
//console.log("Done.");
|
||||
}
|
||||
//console.log("\r\n");
|
||||
|
||||
})
|
||||
.on('error', function (error) {
|
||||
console.log("==> error " + JSON.stringify(error));
|
||||
console.log("\r\n");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -79,7 +79,8 @@ function importDefinitelyTypedTests(definitelyTypedRoot: string): void {
|
||||
if (err) throw err;
|
||||
|
||||
subDirectorys
|
||||
.filter(d => ["_infrastructure", "node_modules", ".git"].indexOf(d) >= 0)
|
||||
.filter(d => ["_infrastructure", "node_modules", ".git"].indexOf(d) < 0)
|
||||
.filter(i => i.indexOf("sipml") >=0 )
|
||||
.filter(i => fs.statSync(path.join(definitelyTypedRoot, i)).isDirectory())
|
||||
.forEach(d => {
|
||||
var directoryPath = path.join(definitelyTypedRoot, d);
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
declare var require: any, process: any;
|
||||
declare var __dirname: any;
|
||||
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var child_process = require('child_process');
|
||||
|
||||
var tscRoot = path.join(__dirname, "..\\");
|
||||
var tscPath = path.join(tscRoot, "built", "instrumented", "tsc.js");
|
||||
var rwcTestPath = path.join(tscRoot, "tests", "cases", "rwc", "dt");
|
||||
var definitelyTypedRoot = process.argv[2];
|
||||
|
||||
function fileExtensionIs(path: string, extension: string): boolean {
|
||||
var pathLen = path.length;
|
||||
var extLen = extension.length;
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen).toLocaleLowerCase() === extension.toLocaleLowerCase();
|
||||
}
|
||||
|
||||
function copyFileSync(source, destination) {
|
||||
var text = fs.readFileSync(source);
|
||||
fs.writeFileSync(destination, text);
|
||||
}
|
||||
|
||||
function importDefinitelyTypedTest(testCaseName: string, testFiles: string[], responseFile: string ) {
|
||||
var cmd = "node " + tscPath + " --module commonjs " + testFiles.join(" ");
|
||||
if (responseFile) cmd += " @" + responseFile;
|
||||
|
||||
var testDirectoryName = testCaseName + "_" + Math.floor((Math.random() * 10000) + 1);
|
||||
var testDirectoryPath = path.join(process.env["temp"], testDirectoryName);
|
||||
if (fs.existsSync(testDirectoryPath)) {
|
||||
throw new Error("Could not create test directory");
|
||||
}
|
||||
fs.mkdirSync(testDirectoryPath);
|
||||
|
||||
child_process.exec(cmd, {
|
||||
maxBuffer: 1 * 1024 * 1024,
|
||||
cwd: testDirectoryPath
|
||||
}, (error, stdout, stderr) => {
|
||||
//console.log("importing " + testCaseName + " ...");
|
||||
//console.log(cmd);
|
||||
|
||||
if (error) {
|
||||
console.log("importing " + testCaseName + " ...");
|
||||
console.log(cmd);
|
||||
console.log("==> error " + JSON.stringify(error));
|
||||
console.log("==> stdout " + String(stdout));
|
||||
console.log("==> stderr " + String(stderr));
|
||||
console.log("\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// copy generated file to output location
|
||||
var outputFilePath = path.join(testDirectoryPath, "iocapture0.json");
|
||||
var testCasePath = path.join(rwcTestPath, "DefinitelyTyped_" + testCaseName + ".json");
|
||||
copyFileSync(outputFilePath, testCasePath);
|
||||
|
||||
//console.log("output generated at: " + outputFilePath);
|
||||
|
||||
if (!fs.existsSync(testCasePath)) {
|
||||
throw new Error("could not find test case at: " + testCasePath);
|
||||
}
|
||||
else {
|
||||
fs.unlinkSync(outputFilePath);
|
||||
fs.rmdirSync(testDirectoryPath);
|
||||
//console.log("testcase generated at: " + testCasePath);
|
||||
//console.log("Done.");
|
||||
}
|
||||
//console.log("\r\n");
|
||||
|
||||
})
|
||||
.on('error', function (error) {
|
||||
console.log("==> error " + JSON.stringify(error));
|
||||
console.log("\r\n");
|
||||
});
|
||||
}
|
||||
|
||||
function importDefinitelyTypedTests(definitelyTypedRoot: string): void {
|
||||
fs.readdir(definitelyTypedRoot, (err, subDirectorys) => {
|
||||
if (err) throw err;
|
||||
|
||||
subDirectorys
|
||||
.filter(d => ["_infrastructure", "node_modules", ".git"].indexOf(d) >= 0)
|
||||
.filter(i => fs.statSync(path.join(definitelyTypedRoot, i)).isDirectory())
|
||||
.forEach(d => {
|
||||
var directoryPath = path.join(definitelyTypedRoot, d);
|
||||
fs.readdir(directoryPath, function (err, files) {
|
||||
if (err) throw err;
|
||||
|
||||
var tsFiles = [];
|
||||
var testFiles = [];
|
||||
var paramFile;
|
||||
|
||||
files
|
||||
.map(f => path.join(directoryPath, f))
|
||||
.forEach(f => {
|
||||
if (fileExtensionIs(f, ".ts")) tsFiles.push(f);
|
||||
else if (fileExtensionIs(f, ".tscparams")) paramFile = f;
|
||||
|
||||
if (fileExtensionIs(f, "-tests.ts")) testFiles.push(f);
|
||||
});
|
||||
|
||||
if (testFiles.length === 0) {
|
||||
// no test files but multiple d.ts's, e.g. winjs
|
||||
var regexp = new RegExp(d + "(([-][0-9])|([\.]d[\.]ts))");
|
||||
if (tsFiles.length > 1 && tsFiles.every(t => fileExtensionIs(t, ".d.ts") && regexp.test(t))) {
|
||||
tsFiles.forEach(filename => {
|
||||
importDefinitelyTypedTest(path.basename(filename, ".d.ts"), [filename], paramFile);
|
||||
});
|
||||
}
|
||||
else {
|
||||
importDefinitelyTypedTest(d, tsFiles, paramFile);
|
||||
}
|
||||
}
|
||||
else {
|
||||
testFiles.forEach(filename => {
|
||||
importDefinitelyTypedTest(path.basename(filename, "-tests.ts"), [filename], paramFile);
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
importDefinitelyTypedTests(definitelyTypedRoot);
|
||||
+106
-83
@@ -37,7 +37,9 @@ module ts {
|
||||
|
||||
var emptyArray: any[] = [];
|
||||
var emptySymbols: SymbolTable = {};
|
||||
|
||||
|
||||
var compilerOptions = program.getCompilerOptions();
|
||||
|
||||
var checker: TypeChecker = {
|
||||
getProgram: () => program,
|
||||
getDiagnostics: getDiagnostics,
|
||||
@@ -907,8 +909,8 @@ module ts {
|
||||
|
||||
// Get qualified name
|
||||
if (enclosingDeclaration &&
|
||||
// Properties/methods/Signatures/Constructors/TypeParameters do not need qualification
|
||||
!(symbol.flags & (SymbolFlags.PropertyOrAccessor | SymbolFlags.Signature | SymbolFlags.Constructor | SymbolFlags.Method | SymbolFlags.TypeParameter))) {
|
||||
// TypeParameters do not need qualification
|
||||
!(symbol.flags & SymbolFlags.TypeParameter)) {
|
||||
var symbolName: string;
|
||||
while (symbol) {
|
||||
var isFirstName = !symbolName;
|
||||
@@ -943,20 +945,37 @@ module ts {
|
||||
writer.write(symbolToString(symbol, enclosingDeclaration, meaning));
|
||||
}
|
||||
|
||||
function createSingleLineTextWriter() {
|
||||
function createSingleLineTextWriter(maxLength?: number) {
|
||||
var result = "";
|
||||
var overflow = false;
|
||||
function write(s: string) {
|
||||
if (!overflow) {
|
||||
result += s;
|
||||
if (result.length > maxLength) {
|
||||
result = result.substr(0, maxLength - 3) + "...";
|
||||
overflow = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
write(s: string) { result += s; },
|
||||
writeSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) { writeSymbolToTextWriter(symbol, enclosingDeclaration, meaning, this); },
|
||||
writeLine() { result += " "; },
|
||||
write: write,
|
||||
writeSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) {
|
||||
writeSymbolToTextWriter(symbol, enclosingDeclaration, meaning, this);
|
||||
},
|
||||
writeLine() {
|
||||
write(" ");
|
||||
},
|
||||
increaseIndent() { },
|
||||
decreaseIndent() { },
|
||||
getText() { return result; }
|
||||
getText() {
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string {
|
||||
var stringWriter = createSingleLineTextWriter();
|
||||
var maxLength = compilerOptions.noErrorTruncation || flags & TypeFormatFlags.NoTruncation ? undefined : 100;
|
||||
var stringWriter = createSingleLineTextWriter(maxLength);
|
||||
// TODO(shkamat): typeToString should take enclosingDeclaration as input, once we have implemented enclosingDeclaration
|
||||
writeTypeToTextWriter(type, enclosingDeclaration, flags, stringWriter);
|
||||
return stringWriter.getText();
|
||||
@@ -1348,7 +1367,7 @@ module ts {
|
||||
return type;
|
||||
|
||||
function checkImplicitAny(type: Type) {
|
||||
if (!fullTypeCheck || !program.getCompilerOptions().noImplicitAny) {
|
||||
if (!fullTypeCheck || !compilerOptions.noImplicitAny) {
|
||||
return;
|
||||
}
|
||||
// We need to have ended up with 'any', 'any[]', 'any[][]', etc.
|
||||
@@ -1451,7 +1470,7 @@ module ts {
|
||||
}
|
||||
// Otherwise, fall back to 'any'.
|
||||
else {
|
||||
if (program.getCompilerOptions().noImplicitAny) {
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
error(setter, Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbol.name);
|
||||
}
|
||||
|
||||
@@ -3132,45 +3151,6 @@ module ts {
|
||||
return (type.flags & TypeFlags.Anonymous) && type.symbol && (type.symbol.flags & SymbolFlags.ObjectLiteral) ? true : false;
|
||||
}
|
||||
|
||||
function getWidenedTypeOfObjectLiteral(type: Type): Type {
|
||||
var properties = getPropertiesOfType(type);
|
||||
if (properties.length) {
|
||||
var widenedTypes: Type[] = [];
|
||||
var propTypeWasWidened: boolean = false;
|
||||
forEach(properties, p => {
|
||||
var propType = getTypeOfSymbol(p);
|
||||
var widenedType = getWidenedType(propType);
|
||||
if (propType !== widenedType) {
|
||||
propTypeWasWidened = true;
|
||||
|
||||
if (program.getCompilerOptions().noImplicitAny && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) {
|
||||
error(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(widenedType));
|
||||
}
|
||||
}
|
||||
widenedTypes.push(widenedType);
|
||||
});
|
||||
if (propTypeWasWidened) {
|
||||
var members: SymbolTable = {};
|
||||
var index = 0;
|
||||
forEach(properties, p => {
|
||||
var symbol = <TransientSymbol>createSymbol(SymbolFlags.Property | SymbolFlags.Transient, p.name);
|
||||
symbol.declarations = p.declarations;
|
||||
symbol.parent = p.parent;
|
||||
symbol.type = widenedTypes[index++];
|
||||
symbol.target = p;
|
||||
if (p.valueDeclaration) symbol.valueDeclaration = p.valueDeclaration;
|
||||
members[symbol.name] = symbol;
|
||||
});
|
||||
var stringIndexType = getIndexTypeOfType(type, IndexKind.String);
|
||||
var numberIndexType = getIndexTypeOfType(type, IndexKind.Number);
|
||||
if (stringIndexType) stringIndexType = getWidenedType(stringIndexType);
|
||||
if (numberIndexType) numberIndexType = getWidenedType(numberIndexType);
|
||||
type = createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
function isArrayType(type: Type): boolean {
|
||||
return type.flags & TypeFlags.Reference && (<TypeReference>type).target === globalArrayType;
|
||||
}
|
||||
@@ -3183,17 +3163,8 @@ module ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function getWidenedTypeOfArrayLiteral(type: Type): Type {
|
||||
var elementType = (<TypeReference>type).typeArguments[0];
|
||||
var widenedType = getWidenedType(elementType);
|
||||
|
||||
type = elementType !== widenedType ? createArrayType(widenedType) : type;
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
/* If we are widening on a literal, then we may need to the 'node' parameter for reporting purposes */
|
||||
function getWidenedType(type: Type): Type {
|
||||
function getWidenedType(type: Type, supressNoImplicitAnyErrors?: boolean): Type {
|
||||
if (type.flags & (TypeFlags.Undefined | TypeFlags.Null)) {
|
||||
return anyType;
|
||||
}
|
||||
@@ -3204,6 +3175,54 @@ module ts {
|
||||
return getWidenedTypeOfArrayLiteral(type);
|
||||
}
|
||||
return type;
|
||||
|
||||
function getWidenedTypeOfObjectLiteral(type: Type): Type {
|
||||
var properties = getPropertiesOfType(type);
|
||||
if (properties.length) {
|
||||
var widenedTypes: Type[] = [];
|
||||
var propTypeWasWidened: boolean = false;
|
||||
forEach(properties, p => {
|
||||
var propType = getTypeOfSymbol(p);
|
||||
var widenedType = getWidenedType(propType);
|
||||
if (propType !== widenedType) {
|
||||
propTypeWasWidened = true;
|
||||
|
||||
if (!supressNoImplicitAnyErrors && program.getCompilerOptions().noImplicitAny && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) {
|
||||
error(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(widenedType));
|
||||
}
|
||||
}
|
||||
widenedTypes.push(widenedType);
|
||||
});
|
||||
if (propTypeWasWidened) {
|
||||
var members: SymbolTable = {};
|
||||
var index = 0;
|
||||
forEach(properties, p => {
|
||||
var symbol = <TransientSymbol>createSymbol(SymbolFlags.Property | SymbolFlags.Transient, p.name);
|
||||
symbol.declarations = p.declarations;
|
||||
symbol.parent = p.parent;
|
||||
symbol.type = widenedTypes[index++];
|
||||
symbol.target = p;
|
||||
if (p.valueDeclaration) symbol.valueDeclaration = p.valueDeclaration;
|
||||
members[symbol.name] = symbol;
|
||||
});
|
||||
var stringIndexType = getIndexTypeOfType(type, IndexKind.String);
|
||||
var numberIndexType = getIndexTypeOfType(type, IndexKind.Number);
|
||||
if (stringIndexType) stringIndexType = getWidenedType(stringIndexType);
|
||||
if (numberIndexType) numberIndexType = getWidenedType(numberIndexType);
|
||||
type = createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
function getWidenedTypeOfArrayLiteral(type: Type): Type {
|
||||
var elementType = (<TypeReference>type).typeArguments[0];
|
||||
var widenedType = getWidenedType(elementType, supressNoImplicitAnyErrors);
|
||||
|
||||
type = elementType !== widenedType ? createArrayType(widenedType) : type;
|
||||
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
function forEachMatchingParameterType(source: Signature, target: Signature, callback: (s: Type, t: Type) => void) {
|
||||
@@ -3951,7 +3970,7 @@ module ts {
|
||||
}
|
||||
|
||||
// Fall back to any.
|
||||
if (program.getCompilerOptions().noImplicitAny && objectType !== anyType) {
|
||||
if (compilerOptions.noImplicitAny && objectType !== anyType) {
|
||||
error(node, Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type);
|
||||
}
|
||||
|
||||
@@ -4049,19 +4068,6 @@ module ts {
|
||||
return getSignatureInstantiation(signature, getInferredTypes(context));
|
||||
}
|
||||
|
||||
// Inferentially type an expression by a contextual parameter type (section 4.12.2 in TypeScript spec)
|
||||
function inferentiallyTypeExpession(expr: Expression, contextualType: Type, contextualMapper: TypeMapper): Type {
|
||||
var type = checkExpressionWithContextualType(expr, contextualType, contextualMapper);
|
||||
var signature = getSingleCallSignature(type);
|
||||
if (signature && signature.typeParameters) {
|
||||
var contextualSignature = getSingleCallSignature(contextualType);
|
||||
if (contextualSignature && !contextualSignature.typeParameters) {
|
||||
type = getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper));
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
function inferTypeArguments(signature: Signature, args: Expression[], excludeArgument?: boolean[]): Type[] {
|
||||
var typeParameters = signature.typeParameters;
|
||||
var context = createInferenceContext(typeParameters);
|
||||
@@ -4070,7 +4076,7 @@ module ts {
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
if (!excludeArgument || excludeArgument[i] === undefined) {
|
||||
var parameterType = getTypeAtPosition(signature, i);
|
||||
inferTypes(context, inferentiallyTypeExpession(args[i], parameterType, mapper), parameterType);
|
||||
inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType);
|
||||
}
|
||||
}
|
||||
// Next, infer from those context sensitive arguments that are no longer excluded
|
||||
@@ -4078,7 +4084,7 @@ module ts {
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
if (excludeArgument[i] === false) {
|
||||
var parameterType = getTypeAtPosition(signature, i);
|
||||
inferTypes(context, inferentiallyTypeExpession(args[i], parameterType, mapper), parameterType);
|
||||
inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4296,7 +4302,7 @@ module ts {
|
||||
var declaration = signature.declaration;
|
||||
if (declaration && (declaration.kind !== SyntaxKind.Constructor && declaration.kind !== SyntaxKind.ConstructSignature)) {
|
||||
// When resolved signature is a call signature (and not a construct signature) the result type is any
|
||||
if (program.getCompilerOptions().noImplicitAny) {
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
|
||||
}
|
||||
return anyType;
|
||||
@@ -4309,7 +4315,7 @@ module ts {
|
||||
var exprType = checkExpression(node.operand);
|
||||
var targetType = getTypeFromTypeNode(node.type);
|
||||
if (fullTypeCheck && targetType !== unknownType) {
|
||||
var widenedType = getWidenedType(exprType);
|
||||
var widenedType = getWidenedType(exprType, /*supressNoImplicitAnyErrors*/ true);
|
||||
if (!(isTypeAssignableTo(targetType, widenedType))) {
|
||||
checkTypeAssignableTo(exprType, targetType, node, Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other_Colon, Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other);
|
||||
}
|
||||
@@ -4342,7 +4348,7 @@ module ts {
|
||||
var unwidenedType = checkAndMarkExpression(func.body, contextualMapper);
|
||||
var widenedType = getWidenedType(unwidenedType);
|
||||
|
||||
if (fullTypeCheck && program.getCompilerOptions().noImplicitAny && widenedType !== unwidenedType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) {
|
||||
if (fullTypeCheck && compilerOptions.noImplicitAny && widenedType !== unwidenedType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) {
|
||||
error(func, Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeToString(widenedType));
|
||||
}
|
||||
|
||||
@@ -4364,7 +4370,7 @@ module ts {
|
||||
var widenedType = getWidenedType(commonType);
|
||||
|
||||
// Check and report for noImplicitAny if the best common type implicitly gets widened to an 'any'/arrays-of-'any' type.
|
||||
if (fullTypeCheck && program.getCompilerOptions().noImplicitAny && widenedType !== commonType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) {
|
||||
if (fullTypeCheck && compilerOptions.noImplicitAny && widenedType !== commonType && getInnermostTypeOfNestedArrayTypes(widenedType) === anyType) {
|
||||
var typeName = typeToString(widenedType);
|
||||
|
||||
if (func.name) {
|
||||
@@ -4782,6 +4788,23 @@ module ts {
|
||||
// have the wildcard function type; this form of type check is used during overload resolution to exclude
|
||||
// contextually typed function and arrow expressions in the initial phase.
|
||||
function checkExpression(node: Expression, contextualMapper?: TypeMapper): Type {
|
||||
var type = checkExpressionNode(node, contextualMapper);
|
||||
if (contextualMapper && contextualMapper !== identityMapper) {
|
||||
var signature = getSingleCallSignature(type);
|
||||
if (signature && signature.typeParameters) {
|
||||
var contextualType = getContextualType(node);
|
||||
if (contextualType) {
|
||||
var contextualSignature = getSingleCallSignature(contextualType);
|
||||
if (contextualSignature && !contextualSignature.typeParameters) {
|
||||
type = getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
function checkExpressionNode(node: Expression, contextualMapper: TypeMapper): Type {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
return checkIdentifier(<Identifier>node);
|
||||
@@ -4909,7 +4932,7 @@ module ts {
|
||||
checkCollisionWithCapturedThisVariable(node, node.name);
|
||||
checkCollistionWithRequireExportsInGeneratedCode(node, node.name);
|
||||
checkCollisionWithArgumentsInGeneratedCode(node);
|
||||
if (program.getCompilerOptions().noImplicitAny && !node.type) {
|
||||
if (compilerOptions.noImplicitAny && !node.type) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ConstructSignature:
|
||||
error(node, Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
|
||||
@@ -5465,7 +5488,7 @@ module ts {
|
||||
}
|
||||
|
||||
// If there is no body and no explicit return type, then report an error.
|
||||
if (fullTypeCheck && program.getCompilerOptions().noImplicitAny && !node.body && !node.type) {
|
||||
if (fullTypeCheck && compilerOptions.noImplicitAny && !node.body && !node.type) {
|
||||
// Ignore privates within ambient contexts; they exist purely for documentative purposes to avoid name clashing.
|
||||
// (e.g. privates within .d.ts files do not expose type information)
|
||||
if (!isPrivateWithinAmbient(node)) {
|
||||
@@ -7099,7 +7122,7 @@ module ts {
|
||||
function shouldEmitDeclarations() {
|
||||
// If the declaration emit and there are no errors being reported in program or by checker
|
||||
// declarations can be emitted
|
||||
return program.getCompilerOptions().declaration &&
|
||||
return compilerOptions.declaration &&
|
||||
!program.getDiagnostics().length &&
|
||||
!getDiagnostics().length;
|
||||
}
|
||||
|
||||
@@ -198,6 +198,9 @@ module ts {
|
||||
|
||||
export function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic;
|
||||
export function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage): Diagnostic {
|
||||
Debug.assert(start >= 0, "start must be non-negative, is " + start);
|
||||
Debug.assert(length >= 0, "length must be non-negative, is " + length);
|
||||
|
||||
var text = getLocaleSpecificMessage(message.key);
|
||||
|
||||
if (arguments.length > 4) {
|
||||
@@ -252,6 +255,9 @@ module ts {
|
||||
}
|
||||
|
||||
export function flattenDiagnosticChain(file: SourceFile, start: number, length: number, diagnosticChain: DiagnosticMessageChain, newLine: string): Diagnostic {
|
||||
Debug.assert(start >= 0, "start must be non-negative, is " + start);
|
||||
Debug.assert(length >= 0, "length must be non-negative, is " + length);
|
||||
|
||||
var code = diagnosticChain.code;
|
||||
var category = diagnosticChain.category;
|
||||
var messageText = "";
|
||||
|
||||
@@ -81,7 +81,7 @@ module ts {
|
||||
export function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic {
|
||||
node = getErrorSpanForNode(node);
|
||||
var file = getSourceFileOfNode(node);
|
||||
var start = skipTrivia(file.text, node.pos);
|
||||
var start = node.kind === SyntaxKind.Missing ? node.pos : skipTrivia(file.text, node.pos);
|
||||
var length = node.end - start;
|
||||
|
||||
return createFileDiagnostic(file, start, length, message, arg0, arg1, arg2);
|
||||
@@ -2977,10 +2977,11 @@ module ts {
|
||||
parseExpected(SyntaxKind.VarKeyword);
|
||||
node.declarations = parseVariableDeclarationList(flags, /*noIn*/false);
|
||||
parseSemicolon();
|
||||
finishNode(node);
|
||||
if (!node.declarations.length && file.syntacticErrors.length === errorCountBeforeVarStatement) {
|
||||
grammarErrorOnNode(node, Diagnostics.Variable_declaration_list_cannot_be_empty);
|
||||
}
|
||||
return finishNode(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
function parseFunctionDeclaration(pos?: number, flags?: NodeFlags): FunctionDeclaration {
|
||||
|
||||
@@ -631,12 +631,10 @@ module ts {
|
||||
}
|
||||
|
||||
export enum TypeFormatFlags {
|
||||
None = 0x00000000,
|
||||
|
||||
/** writes Array<T> instead T[] */
|
||||
WriteArrayAsGenericType = 0x00000001, // Declarations
|
||||
|
||||
UseTypeOfFunction = 0x00000002, // instead of writing signature type of function use typeof
|
||||
None = 0x00000000,
|
||||
WriteArrayAsGenericType = 0x00000001, // Write Array<T> instead T[]
|
||||
UseTypeOfFunction = 0x00000002, // Write typeof instead of function type literal
|
||||
NoTruncation = 0x00000004, // Don't truncate typeToString result
|
||||
}
|
||||
|
||||
export enum SymbolAccessibility {
|
||||
@@ -957,6 +955,7 @@ module ts {
|
||||
locale?: string;
|
||||
mapRoot?: string;
|
||||
module?: ModuleKind;
|
||||
noErrorTruncation?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
noLib?: boolean;
|
||||
noLibCheck?: boolean;
|
||||
@@ -969,7 +968,6 @@ module ts {
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
|
||||
[option: string]: any;
|
||||
}
|
||||
|
||||
|
||||
@@ -622,6 +622,7 @@ module Harness {
|
||||
options = options || { noResolve: false };
|
||||
options.target = options.target || ts.ScriptTarget.ES3;
|
||||
options.module = options.module || ts.ModuleKind.None;
|
||||
options.noErrorTruncation = true;
|
||||
|
||||
if (settingsCallback) {
|
||||
settingsCallback(null);
|
||||
@@ -725,6 +726,10 @@ module Harness {
|
||||
options.emitBOM = !!setting.value;
|
||||
break;
|
||||
|
||||
case 'errortruncation':
|
||||
options.noErrorTruncation = setting.value === 'false';
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error('Unsupported compiler setting ' + setting.flag);
|
||||
}
|
||||
@@ -1030,7 +1035,7 @@ module Harness {
|
||||
var optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*(\S*)/gm; // multiple matches on multiple lines
|
||||
|
||||
// List of allowed metadata names
|
||||
var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outDir", "noimplicitany", "noresolve", "newline", "newlines", "emitbom"];
|
||||
var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outDir", "noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation"];
|
||||
|
||||
function extractCompilerSettings(content: string): CompilerSetting[] {
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ class TypeWriterWalker {
|
||||
column: lineAndCharacter.character,
|
||||
syntaxKind: ts.SyntaxKind[node.kind],
|
||||
sourceText: sourceText,
|
||||
type: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.None)
|
||||
type: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Vendored
+17
-12
@@ -1886,6 +1886,23 @@ declare var HTMLCollection: {
|
||||
new(): HTMLCollection;
|
||||
}
|
||||
|
||||
interface BlobPropertyBag {
|
||||
type?: string;
|
||||
endings?: string;
|
||||
}
|
||||
|
||||
interface Blob {
|
||||
type: string;
|
||||
size: number;
|
||||
msDetachStream(): any;
|
||||
slice(start?: number, end?: number, contentType?: string): Blob;
|
||||
msClose(): void;
|
||||
}
|
||||
declare var Blob: {
|
||||
prototype: Blob;
|
||||
new (blobParts?: any[], options?: BlobPropertyBag): Blob;
|
||||
}
|
||||
|
||||
interface NavigatorID {
|
||||
appVersion: string;
|
||||
appName: string;
|
||||
@@ -10027,18 +10044,6 @@ declare var FileReader: {
|
||||
new(): FileReader;
|
||||
}
|
||||
|
||||
interface Blob {
|
||||
type: string;
|
||||
size: number;
|
||||
msDetachStream(): any;
|
||||
slice(start?: number, end?: number, contentType?: string): Blob;
|
||||
msClose(): void;
|
||||
}
|
||||
declare var Blob: {
|
||||
prototype: Blob;
|
||||
new(): Blob;
|
||||
}
|
||||
|
||||
interface ApplicationCache extends EventTarget {
|
||||
status: number;
|
||||
ondownloading: (ev: Event) => any;
|
||||
|
||||
Vendored
+6
-1
@@ -614,6 +614,11 @@ declare var FileReader: {
|
||||
new(): FileReader;
|
||||
}
|
||||
|
||||
interface BlobPropertyBag {
|
||||
type?: string;
|
||||
endings?: string;
|
||||
}
|
||||
|
||||
interface Blob {
|
||||
type: string;
|
||||
size: number;
|
||||
@@ -623,7 +628,7 @@ interface Blob {
|
||||
}
|
||||
declare var Blob: {
|
||||
prototype: Blob;
|
||||
new(): Blob;
|
||||
new (blobParts?: any[], options?: BlobPropertyBag): Blob;
|
||||
}
|
||||
|
||||
interface MSStream {
|
||||
|
||||
@@ -557,11 +557,11 @@ declare var i1_ncf: (b: number) => number;
|
||||
declare var i1_ncr: number;
|
||||
declare var i1_ncprop: number;
|
||||
declare var i1_s_p: number;
|
||||
declare var i1_s_f: typeof s2;
|
||||
declare var i1_s_f: typeof c1.s2;
|
||||
declare var i1_s_r: number;
|
||||
declare var i1_s_prop: number;
|
||||
declare var i1_s_nc_p: number;
|
||||
declare var i1_s_ncf: typeof nc_s2;
|
||||
declare var i1_s_ncf: typeof c1.nc_s2;
|
||||
declare var i1_s_ncr: number;
|
||||
declare var i1_s_ncprop: number;
|
||||
declare var i1_c: typeof c1;
|
||||
@@ -577,111 +577,3 @@ declare class cProperties {
|
||||
private y;
|
||||
}
|
||||
declare var cProperties_i: cProperties;
|
||||
|
||||
|
||||
//// [DtsFileErrors]
|
||||
|
||||
|
||||
==== tests/cases/compiler/commentsClassMembers.d.ts (2 errors) ====
|
||||
/** This is comment for c1*/
|
||||
declare class c1 {
|
||||
/** p1 is property of c1*/
|
||||
p1: number;
|
||||
/** sum with property*/
|
||||
p2(/** number to add*/ b: number): number;
|
||||
/** getter property*/
|
||||
/** setter property*/
|
||||
p3: number;
|
||||
/** pp1 is property of c1*/
|
||||
private pp1;
|
||||
/** sum with property*/
|
||||
private pp2(/** number to add*/ b);
|
||||
/** getter property*/
|
||||
/** setter property*/
|
||||
private pp3;
|
||||
/** Constructor method*/
|
||||
constructor();
|
||||
/** s1 is static property of c1*/
|
||||
static s1: number;
|
||||
/** static sum with property*/
|
||||
static s2(/** number to add*/ b: number): number;
|
||||
/** static getter property*/
|
||||
/** setter property*/
|
||||
static s3: number;
|
||||
nc_p1: number;
|
||||
nc_p2(b: number): number;
|
||||
nc_p3: number;
|
||||
private nc_pp1;
|
||||
private nc_pp2(b);
|
||||
private nc_pp3;
|
||||
static nc_s1: number;
|
||||
static nc_s2(b: number): number;
|
||||
static nc_s3: number;
|
||||
a_p1: number;
|
||||
a_p2(b: number): number;
|
||||
a_p3: number;
|
||||
private a_pp1;
|
||||
private a_pp2(b);
|
||||
private a_pp3;
|
||||
static a_s1: number;
|
||||
static a_s2(b: number): number;
|
||||
static a_s3: number;
|
||||
/** p1 is property of c1 */
|
||||
b_p1: number;
|
||||
/** sum with property */
|
||||
b_p2(b: number): number;
|
||||
/** getter property */
|
||||
/** setter property */
|
||||
b_p3: number;
|
||||
/** pp1 is property of c1 */
|
||||
private b_pp1;
|
||||
/** sum with property */
|
||||
private b_pp2(b);
|
||||
/** getter property */
|
||||
/** setter property */
|
||||
private b_pp3;
|
||||
/** s1 is static property of c1 */
|
||||
static b_s1: number;
|
||||
/** static sum with property */
|
||||
static b_s2(b: number): number;
|
||||
/** static getter property
|
||||
*/
|
||||
/** setter property
|
||||
*/
|
||||
static b_s3: number;
|
||||
}
|
||||
declare var i1: c1;
|
||||
declare var i1_p: number;
|
||||
declare var i1_f: (b: number) => number;
|
||||
declare var i1_r: number;
|
||||
declare var i1_prop: number;
|
||||
declare var i1_nc_p: number;
|
||||
declare var i1_ncf: (b: number) => number;
|
||||
declare var i1_ncr: number;
|
||||
declare var i1_ncprop: number;
|
||||
declare var i1_s_p: number;
|
||||
declare var i1_s_f: typeof s2;
|
||||
~~
|
||||
!!! Cannot find name 's2'.
|
||||
declare var i1_s_r: number;
|
||||
declare var i1_s_prop: number;
|
||||
declare var i1_s_nc_p: number;
|
||||
declare var i1_s_ncf: typeof nc_s2;
|
||||
~~~~~
|
||||
!!! Cannot find name 'nc_s2'.
|
||||
declare var i1_s_ncr: number;
|
||||
declare var i1_s_ncprop: number;
|
||||
declare var i1_c: typeof c1;
|
||||
declare class cProperties {
|
||||
private val;
|
||||
/** getter only property*/
|
||||
p1: number;
|
||||
nc_p1: number;
|
||||
/**setter only property*/
|
||||
p2: number;
|
||||
nc_p2: number;
|
||||
x: number;
|
||||
private y;
|
||||
}
|
||||
declare var cProperties_i: cProperties;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
==== tests/cases/compiler/errorWithTruncatedType.ts (1 errors) ====
|
||||
|
||||
var x: {
|
||||
propertyWithAnExceedinglyLongName1: string;
|
||||
propertyWithAnExceedinglyLongName2: string;
|
||||
propertyWithAnExceedinglyLongName3: string;
|
||||
propertyWithAnExceedinglyLongName4: string;
|
||||
propertyWithAnExceedinglyLongName5: string;
|
||||
};
|
||||
|
||||
// String representation of type of 'x' should be truncated in error message
|
||||
var s: string = x;
|
||||
~
|
||||
!!! Type '{ propertyWithAnExceedinglyLongName1: string; propertyWithAnExceedinglyLongName2: string; propert...' is not assignable to type 'string'.
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [errorWithTruncatedType.ts]
|
||||
|
||||
var x: {
|
||||
propertyWithAnExceedinglyLongName1: string;
|
||||
propertyWithAnExceedinglyLongName2: string;
|
||||
propertyWithAnExceedinglyLongName3: string;
|
||||
propertyWithAnExceedinglyLongName4: string;
|
||||
propertyWithAnExceedinglyLongName5: string;
|
||||
};
|
||||
|
||||
// String representation of type of 'x' should be truncated in error message
|
||||
var s: string = x;
|
||||
|
||||
|
||||
//// [errorWithTruncatedType.js]
|
||||
var x;
|
||||
// String representation of type of 'x' should be truncated in error message
|
||||
var s = x;
|
||||
@@ -10,9 +10,9 @@
|
||||
// more args not allowed
|
||||
var r2 = foo({ cb: <T>(x: T, y: T) => '' }); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ cb: <T>(x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: (t: any) => string; }'.
|
||||
!!! Argument of type '{ cb: <T>(x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: (t: {}) => string; }'.
|
||||
!!! Types of property 'cb' are incompatible:
|
||||
!!! Type '<T>(x: T, y: T) => string' is not assignable to type '(t: any) => string'.
|
||||
!!! Type '<T>(x: T, y: T) => string' is not assignable to type '(t: {}) => string'.
|
||||
var r3 = foo({ cb: (x: string, y: number) => '' }); // error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! Argument of type '{ cb: (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: (t: string) => string; }'.
|
||||
|
||||
@@ -20,10 +20,10 @@ declare function identity<V>(y: V): V;
|
||||
>V : V
|
||||
|
||||
var s = map("", () => { return { x: identity }; });
|
||||
>s : any
|
||||
>map("", () => { return { x: identity }; }) : any
|
||||
>s : string
|
||||
>map("", () => { return { x: identity }; }) : string
|
||||
>map : <T, U>(x: T, f: () => { x: (s: T) => U; }) => U
|
||||
>() => { return { x: identity }; } : () => { x: <V>(y: V) => V; }
|
||||
>() => { return { x: identity }; } : () => { x: (y: string) => string; }
|
||||
>{ x: identity } : { x: <V>(y: V) => V; }
|
||||
>x : <V>(y: V) => V
|
||||
>identity : <V>(y: V) => V
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
==== tests/cases/compiler/noImplicitAnyInCastExpression.ts (1 errors) ====
|
||||
|
||||
// verify no noImplictAny errors reported with cast expression
|
||||
|
||||
interface IFoo {
|
||||
a: number;
|
||||
b: string;
|
||||
}
|
||||
|
||||
// Expr type not assignable to target type
|
||||
(<IFoo>{ a: null });
|
||||
|
||||
// Expr type assignable to target type
|
||||
(<IFoo>{ a: 2, b: undefined });
|
||||
|
||||
// Neither types is assignable to each other
|
||||
(<IFoo>{ c: null });
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! Neither type '{ c: null; }' nor type 'IFoo' is assignable to the other:
|
||||
!!! Property 'a' is missing in type '{ c: null; }'.
|
||||
@@ -0,0 +1,26 @@
|
||||
//// [noImplicitAnyInCastExpression.ts]
|
||||
|
||||
// verify no noImplictAny errors reported with cast expression
|
||||
|
||||
interface IFoo {
|
||||
a: number;
|
||||
b: string;
|
||||
}
|
||||
|
||||
// Expr type not assignable to target type
|
||||
(<IFoo>{ a: null });
|
||||
|
||||
// Expr type assignable to target type
|
||||
(<IFoo>{ a: 2, b: undefined });
|
||||
|
||||
// Neither types is assignable to each other
|
||||
(<IFoo>{ c: null });
|
||||
|
||||
//// [noImplicitAnyInCastExpression.js]
|
||||
// verify no noImplictAny errors reported with cast expression
|
||||
// Expr type not assignable to target type
|
||||
{ a: null };
|
||||
// Expr type assignable to target type
|
||||
{ a: 2, b: undefined };
|
||||
// Neither types is assignable to each other
|
||||
{ c: null };
|
||||
@@ -2,5 +2,5 @@
|
||||
function =>
|
||||
~~
|
||||
!!! Identifier expected.
|
||||
|
||||
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
@@ -8,5 +8,5 @@
|
||||
!!! ',' expected.
|
||||
|
||||
!!! ')' expected.
|
||||
|
||||
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDeclaration6.ts (1 errors) ====
|
||||
var
|
||||
|
||||
~~~
|
||||
!!! Variable declaration list cannot be empty.
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/VariableDeclarations/parserVariableDeclaration8.ts (1 errors) ====
|
||||
var ;
|
||||
|
||||
~~~~~
|
||||
!!! Variable declaration list cannot be empty.
|
||||
@@ -3,8 +3,8 @@ class C {
|
||||
>C : C
|
||||
|
||||
static g(t: typeof C.g){ }
|
||||
>g : (t: typeof g) => void
|
||||
>t : (t: typeof g) => void
|
||||
>g : (t: typeof C.g) => void
|
||||
>t : (t: typeof C.g) => void
|
||||
>C : typeof C
|
||||
>g : (t: typeof g) => void
|
||||
>g : (t: typeof C.g) => void
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// @errortruncation: true
|
||||
|
||||
var x: {
|
||||
propertyWithAnExceedinglyLongName1: string;
|
||||
propertyWithAnExceedinglyLongName2: string;
|
||||
propertyWithAnExceedinglyLongName3: string;
|
||||
propertyWithAnExceedinglyLongName4: string;
|
||||
propertyWithAnExceedinglyLongName5: string;
|
||||
};
|
||||
|
||||
// String representation of type of 'x' should be truncated in error message
|
||||
var s: string = x;
|
||||
@@ -0,0 +1,17 @@
|
||||
//@noImplicitAny: true
|
||||
|
||||
// verify no noImplictAny errors reported with cast expression
|
||||
|
||||
interface IFoo {
|
||||
a: number;
|
||||
b: string;
|
||||
}
|
||||
|
||||
// Expr type not assignable to target type
|
||||
(<IFoo>{ a: null });
|
||||
|
||||
// Expr type assignable to target type
|
||||
(<IFoo>{ a: 2, b: undefined });
|
||||
|
||||
// Neither types is assignable to each other
|
||||
(<IFoo>{ c: null });
|
||||
@@ -227,11 +227,15 @@ function handleRequestOperation(req: http.ServerRequest, res: http.ServerRespons
|
||||
send('success', res, null);
|
||||
break;
|
||||
case RequestType.DeleteFile:
|
||||
fs.unlinkSync(reqPath);
|
||||
if (fs.existsSync(reqPath)) {
|
||||
fs.unlinkSync(reqPath);
|
||||
}
|
||||
send('success', res, null);
|
||||
break;
|
||||
case RequestType.DeleteDir:
|
||||
fs.rmdirSync(reqPath);
|
||||
if (fs.existsSync(reqPath)) {
|
||||
fs.rmdirSync(reqPath);
|
||||
}
|
||||
send('success', res, null);
|
||||
break;
|
||||
case RequestType.AppendFile:
|
||||
|
||||
Reference in New Issue
Block a user