mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into release-1.5
Conflicts: bin/tsc.js bin/tsserver.js bin/typescript.js bin/typescriptServices.js src/compiler/checker.ts src/compiler/emitter.ts src/services/services.ts src/services/shims.ts tests/baselines/reference/classExpressionWithDecorator1.js tests/baselines/reference/decoratedClassFromExternalModule.js tests/baselines/reference/decoratorOnClass1.js tests/baselines/reference/decoratorOnClass2.js tests/baselines/reference/decoratorOnClass3.js tests/baselines/reference/decoratorOnClass4.js tests/baselines/reference/decoratorOnClass5.js tests/baselines/reference/decoratorOnClass8.js tests/baselines/reference/decoratorOnClassAccessor1.js tests/baselines/reference/decoratorOnClassAccessor2.js tests/baselines/reference/decoratorOnClassAccessor3.js tests/baselines/reference/decoratorOnClassAccessor4.js tests/baselines/reference/decoratorOnClassAccessor5.js tests/baselines/reference/decoratorOnClassAccessor6.js tests/baselines/reference/decoratorOnClassConstructorParameter1.js tests/baselines/reference/decoratorOnClassConstructorParameter4.js tests/baselines/reference/decoratorOnClassMethod1.js tests/baselines/reference/decoratorOnClassMethod10.js tests/baselines/reference/decoratorOnClassMethod11.js tests/baselines/reference/decoratorOnClassMethod12.js tests/baselines/reference/decoratorOnClassMethod13.js tests/baselines/reference/decoratorOnClassMethod2.js tests/baselines/reference/decoratorOnClassMethod3.js tests/baselines/reference/decoratorOnClassMethod4.js tests/baselines/reference/decoratorOnClassMethod5.js tests/baselines/reference/decoratorOnClassMethod6.js tests/baselines/reference/decoratorOnClassMethod7.js tests/baselines/reference/decoratorOnClassMethod8.js tests/baselines/reference/decoratorOnClassMethodParameter1.js tests/baselines/reference/decoratorOnClassProperty1.js tests/baselines/reference/decoratorOnClassProperty10.js tests/baselines/reference/decoratorOnClassProperty11.js tests/baselines/reference/decoratorOnClassProperty2.js tests/baselines/reference/decoratorOnClassProperty3.js tests/baselines/reference/decoratorOnClassProperty6.js tests/baselines/reference/decoratorOnClassProperty7.js tests/baselines/reference/missingDecoratorType.js tests/baselines/reference/sourceMapValidationDecorators.js tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt
This commit is contained in:
@@ -46,3 +46,4 @@ scripts/*.js.map
|
||||
coverage/
|
||||
internal/
|
||||
**/.DS_Store
|
||||
.settings/
|
||||
|
||||
+2
-1
@@ -4,4 +4,5 @@ scripts
|
||||
src
|
||||
tests
|
||||
Jakefile
|
||||
.travis.yml
|
||||
.travis.yml
|
||||
.settings/
|
||||
@@ -127,7 +127,8 @@ var harnessSources = [
|
||||
"services/documentRegistry.ts",
|
||||
"services/preProcessFile.ts",
|
||||
"services/patternMatcher.ts",
|
||||
"versionCache.ts"
|
||||
"versionCache.ts",
|
||||
"convertToBase64.ts"
|
||||
].map(function (f) {
|
||||
return path.join(unittestsDirectory, f);
|
||||
})).concat([
|
||||
Vendored
+1
-1
@@ -561,7 +561,7 @@ interface Math {
|
||||
*/
|
||||
atan(x: number): number;
|
||||
/**
|
||||
* Returns the angle (in radians) from the X axis to a point (y,x).
|
||||
* Returns the angle (in radians) from the X axis to a point.
|
||||
* @param y A numeric expression representing the cartesian y-coordinate.
|
||||
* @param x A numeric expression representing the cartesian x-coordinate.
|
||||
*/
|
||||
|
||||
Vendored
+54
-20
@@ -561,7 +561,7 @@ interface Math {
|
||||
*/
|
||||
atan(x: number): number;
|
||||
/**
|
||||
* Returns the angle (in radians) from the X axis to a point (y,x).
|
||||
* Returns the angle (in radians) from the X axis to a point.
|
||||
* @param y A numeric expression representing the cartesian y-coordinate.
|
||||
* @param x A numeric expression representing the cartesian x-coordinate.
|
||||
*/
|
||||
@@ -1237,11 +1237,41 @@ interface SymbolConstructor {
|
||||
isConcatSpreadable: symbol;
|
||||
|
||||
/**
|
||||
* A method that returns the default iterator for an object.Called by the semantics of the
|
||||
* A method that returns the default iterator for an object. Called by the semantics of the
|
||||
* for-of statement.
|
||||
*/
|
||||
iterator: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that matches the regular expression against a string. Called
|
||||
* by the String.prototype.match method.
|
||||
*/
|
||||
match: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that replaces matched substrings of a string. Called by the
|
||||
* String.prototype.replace method.
|
||||
*/
|
||||
replace: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that returns the index within a string that matches the
|
||||
* regular expression. Called by the String.prototype.search method.
|
||||
*/
|
||||
search: symbol;
|
||||
|
||||
/**
|
||||
* A function valued property that is the constructor function that is used to create
|
||||
* derived objects.
|
||||
*/
|
||||
species: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that splits a string at the indices that match the regular
|
||||
* expression. Called by the String.prototype.split method.
|
||||
*/
|
||||
split: symbol;
|
||||
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
|
||||
* abstract operation.
|
||||
@@ -1628,7 +1658,7 @@ interface IteratorResult<T> {
|
||||
}
|
||||
|
||||
interface Iterator<T> {
|
||||
next(): IteratorResult<T>;
|
||||
next(value?: any): IteratorResult<T>;
|
||||
return?(value?: any): IteratorResult<T>;
|
||||
throw?(e?: any): IteratorResult<T>;
|
||||
}
|
||||
@@ -4728,6 +4758,16 @@ declare module Reflect {
|
||||
function setPrototypeOf(target: any, proto: any): boolean;
|
||||
}
|
||||
|
||||
interface PromiseLike<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the completion of an asynchronous operation
|
||||
*/
|
||||
@@ -4738,14 +4778,16 @@ interface Promise<T> {
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | Promise<TResult>, onrejected?: (reason: any) => TResult | Promise<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch(onrejected?: (reason: any) => T | Promise<T>): Promise<T>;
|
||||
catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
[Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
@@ -4756,13 +4798,11 @@ interface PromiseConstructor {
|
||||
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param init A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
<T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
@@ -4770,15 +4810,7 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of values.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all(values: Promise<void>[]): Promise<void>;
|
||||
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
@@ -4786,7 +4818,7 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T>(values: (T | Promise<T>)[]): Promise<T>;
|
||||
race<T>(values: Iterable<T | PromiseLike<T>>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
@@ -4807,13 +4839,15 @@ interface PromiseConstructor {
|
||||
* @param value A promise.
|
||||
* @returns A promise whose internal state matches the provided promise.
|
||||
*/
|
||||
resolve<T>(value: T | Promise<T>): Promise<T>;
|
||||
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise .
|
||||
* @returns A resolved promise.
|
||||
*/
|
||||
resolve(): Promise<void>;
|
||||
|
||||
[Symbol.species]: Function;
|
||||
}
|
||||
|
||||
declare var Promise: PromiseConstructor;
|
||||
|
||||
Vendored
+145
-1
@@ -561,7 +561,7 @@ interface Math {
|
||||
*/
|
||||
atan(x: number): number;
|
||||
/**
|
||||
* Returns the angle (in radians) from the X axis to a point (y,x).
|
||||
* Returns the angle (in radians) from the X axis to a point.
|
||||
* @param y A numeric expression representing the cartesian y-coordinate.
|
||||
* @param x A numeric expression representing the cartesian x-coordinate.
|
||||
*/
|
||||
@@ -1231,6 +1231,139 @@ interface ArrayBufferView {
|
||||
byteOffset: number;
|
||||
}
|
||||
|
||||
interface DataView {
|
||||
buffer: ArrayBuffer;
|
||||
byteLength: number;
|
||||
byteOffset: number;
|
||||
/**
|
||||
* Gets the Float32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getFloat32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Float64 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getFloat64(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Int8 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt8(byteOffset: number): number;
|
||||
|
||||
/**
|
||||
* Gets the Int16 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt16(byteOffset: number, littleEndian: boolean): number;
|
||||
/**
|
||||
* Gets the Int32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint8 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint8(byteOffset: number): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint16 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint16(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Stores an Float32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setFloat32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Float64 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setFloat64(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int8 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
setInt8(byteOffset: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Stores an Int16 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setInt16(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setInt32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint8 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
setUint8(byteOffset: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint16 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setUint16(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
}
|
||||
|
||||
interface DataViewConstructor {
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
|
||||
}
|
||||
declare var DataView: DataViewConstructor;
|
||||
|
||||
/**
|
||||
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
@@ -7222,6 +7355,8 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.
|
||||
* @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl");
|
||||
*/
|
||||
getContext(contextId: "2d"): CanvasRenderingContext2D;
|
||||
getContext(contextId: "experimental-webgl"): WebGLRenderingContext;
|
||||
getContext(contextId: string, ...args: any[]): CanvasRenderingContext2D | WebGLRenderingContext;
|
||||
/**
|
||||
* Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing.
|
||||
@@ -15703,6 +15838,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
overrideMimeType(mime: string): void;
|
||||
send(data?: Document): void;
|
||||
send(data?: string): void;
|
||||
send(data?: any): void;
|
||||
setRequestHeader(header: string, value: string): void;
|
||||
DONE: number;
|
||||
HEADERS_RECEIVED: number;
|
||||
@@ -15857,11 +15993,13 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"CloseEvent"): CloseEvent;
|
||||
createEvent(eventInterface:"CommandEvent"): CommandEvent;
|
||||
createEvent(eventInterface:"CompositionEvent"): CompositionEvent;
|
||||
createEvent(eventInterface: "CustomEvent"): CustomEvent;
|
||||
createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent;
|
||||
createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent;
|
||||
createEvent(eventInterface:"DragEvent"): DragEvent;
|
||||
createEvent(eventInterface:"ErrorEvent"): ErrorEvent;
|
||||
createEvent(eventInterface:"Event"): Event;
|
||||
createEvent(eventInterface:"Events"): Event;
|
||||
createEvent(eventInterface:"FocusEvent"): FocusEvent;
|
||||
createEvent(eventInterface:"GamepadEvent"): GamepadEvent;
|
||||
createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent;
|
||||
@@ -15876,8 +16014,12 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent;
|
||||
createEvent(eventInterface:"MessageEvent"): MessageEvent;
|
||||
createEvent(eventInterface:"MouseEvent"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseEvents"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent;
|
||||
createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent;
|
||||
createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent;
|
||||
createEvent(eventInterface:"MutationEvent"): MutationEvent;
|
||||
createEvent(eventInterface:"MutationEvents"): MutationEvent;
|
||||
createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent;
|
||||
createEvent(eventInterface:"NavigationEvent"): NavigationEvent;
|
||||
createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer;
|
||||
@@ -15888,6 +16030,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"PopStateEvent"): PopStateEvent;
|
||||
createEvent(eventInterface:"ProgressEvent"): ProgressEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent;
|
||||
createEvent(eventInterface:"StorageEvent"): StorageEvent;
|
||||
createEvent(eventInterface:"TextEvent"): TextEvent;
|
||||
@@ -15895,6 +16038,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"TrackEvent"): TrackEvent;
|
||||
createEvent(eventInterface:"TransitionEvent"): TransitionEvent;
|
||||
createEvent(eventInterface:"UIEvent"): UIEvent;
|
||||
createEvent(eventInterface:"UIEvents"): UIEvent;
|
||||
createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent;
|
||||
createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent;
|
||||
createEvent(eventInterface:"WheelEvent"): WheelEvent;
|
||||
|
||||
Vendored
+144
@@ -61,6 +61,139 @@ interface ArrayBufferView {
|
||||
byteOffset: number;
|
||||
}
|
||||
|
||||
interface DataView {
|
||||
buffer: ArrayBuffer;
|
||||
byteLength: number;
|
||||
byteOffset: number;
|
||||
/**
|
||||
* Gets the Float32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getFloat32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Float64 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getFloat64(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Int8 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt8(byteOffset: number): number;
|
||||
|
||||
/**
|
||||
* Gets the Int16 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt16(byteOffset: number, littleEndian: boolean): number;
|
||||
/**
|
||||
* Gets the Int32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint8 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint8(byteOffset: number): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint16 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint16(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Stores an Float32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setFloat32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Float64 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setFloat64(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int8 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
setInt8(byteOffset: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Stores an Int16 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setInt16(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setInt32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint8 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
setUint8(byteOffset: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint16 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setUint16(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
}
|
||||
|
||||
interface DataViewConstructor {
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
|
||||
}
|
||||
declare var DataView: DataViewConstructor;
|
||||
|
||||
/**
|
||||
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
@@ -6052,6 +6185,8 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.
|
||||
* @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl");
|
||||
*/
|
||||
getContext(contextId: "2d"): CanvasRenderingContext2D;
|
||||
getContext(contextId: "experimental-webgl"): WebGLRenderingContext;
|
||||
getContext(contextId: string, ...args: any[]): CanvasRenderingContext2D | WebGLRenderingContext;
|
||||
/**
|
||||
* Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing.
|
||||
@@ -14533,6 +14668,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
overrideMimeType(mime: string): void;
|
||||
send(data?: Document): void;
|
||||
send(data?: string): void;
|
||||
send(data?: any): void;
|
||||
setRequestHeader(header: string, value: string): void;
|
||||
DONE: number;
|
||||
HEADERS_RECEIVED: number;
|
||||
@@ -14687,11 +14823,13 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"CloseEvent"): CloseEvent;
|
||||
createEvent(eventInterface:"CommandEvent"): CommandEvent;
|
||||
createEvent(eventInterface:"CompositionEvent"): CompositionEvent;
|
||||
createEvent(eventInterface: "CustomEvent"): CustomEvent;
|
||||
createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent;
|
||||
createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent;
|
||||
createEvent(eventInterface:"DragEvent"): DragEvent;
|
||||
createEvent(eventInterface:"ErrorEvent"): ErrorEvent;
|
||||
createEvent(eventInterface:"Event"): Event;
|
||||
createEvent(eventInterface:"Events"): Event;
|
||||
createEvent(eventInterface:"FocusEvent"): FocusEvent;
|
||||
createEvent(eventInterface:"GamepadEvent"): GamepadEvent;
|
||||
createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent;
|
||||
@@ -14706,8 +14844,12 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent;
|
||||
createEvent(eventInterface:"MessageEvent"): MessageEvent;
|
||||
createEvent(eventInterface:"MouseEvent"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseEvents"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent;
|
||||
createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent;
|
||||
createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent;
|
||||
createEvent(eventInterface:"MutationEvent"): MutationEvent;
|
||||
createEvent(eventInterface:"MutationEvents"): MutationEvent;
|
||||
createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent;
|
||||
createEvent(eventInterface:"NavigationEvent"): NavigationEvent;
|
||||
createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer;
|
||||
@@ -14718,6 +14860,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"PopStateEvent"): PopStateEvent;
|
||||
createEvent(eventInterface:"ProgressEvent"): ProgressEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent;
|
||||
createEvent(eventInterface:"StorageEvent"): StorageEvent;
|
||||
createEvent(eventInterface:"TextEvent"): TextEvent;
|
||||
@@ -14725,6 +14868,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"TrackEvent"): TrackEvent;
|
||||
createEvent(eventInterface:"TransitionEvent"): TransitionEvent;
|
||||
createEvent(eventInterface:"UIEvent"): UIEvent;
|
||||
createEvent(eventInterface:"UIEvents"): UIEvent;
|
||||
createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent;
|
||||
createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent;
|
||||
createEvent(eventInterface:"WheelEvent"): WheelEvent;
|
||||
|
||||
Vendored
+65
-20
@@ -561,7 +561,7 @@ interface Math {
|
||||
*/
|
||||
atan(x: number): number;
|
||||
/**
|
||||
* Returns the angle (in radians) from the X axis to a point (y,x).
|
||||
* Returns the angle (in radians) from the X axis to a point.
|
||||
* @param y A numeric expression representing the cartesian y-coordinate.
|
||||
* @param x A numeric expression representing the cartesian x-coordinate.
|
||||
*/
|
||||
@@ -1237,11 +1237,41 @@ interface SymbolConstructor {
|
||||
isConcatSpreadable: symbol;
|
||||
|
||||
/**
|
||||
* A method that returns the default iterator for an object.Called by the semantics of the
|
||||
* A method that returns the default iterator for an object. Called by the semantics of the
|
||||
* for-of statement.
|
||||
*/
|
||||
iterator: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that matches the regular expression against a string. Called
|
||||
* by the String.prototype.match method.
|
||||
*/
|
||||
match: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that replaces matched substrings of a string. Called by the
|
||||
* String.prototype.replace method.
|
||||
*/
|
||||
replace: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that returns the index within a string that matches the
|
||||
* regular expression. Called by the String.prototype.search method.
|
||||
*/
|
||||
search: symbol;
|
||||
|
||||
/**
|
||||
* A function valued property that is the constructor function that is used to create
|
||||
* derived objects.
|
||||
*/
|
||||
species: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that splits a string at the indices that match the regular
|
||||
* expression. Called by the String.prototype.split method.
|
||||
*/
|
||||
split: symbol;
|
||||
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
|
||||
* abstract operation.
|
||||
@@ -1628,7 +1658,7 @@ interface IteratorResult<T> {
|
||||
}
|
||||
|
||||
interface Iterator<T> {
|
||||
next(): IteratorResult<T>;
|
||||
next(value?: any): IteratorResult<T>;
|
||||
return?(value?: any): IteratorResult<T>;
|
||||
throw?(e?: any): IteratorResult<T>;
|
||||
}
|
||||
@@ -4728,6 +4758,16 @@ declare module Reflect {
|
||||
function setPrototypeOf(target: any, proto: any): boolean;
|
||||
}
|
||||
|
||||
interface PromiseLike<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the completion of an asynchronous operation
|
||||
*/
|
||||
@@ -4738,14 +4778,16 @@ interface Promise<T> {
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | Promise<TResult>, onrejected?: (reason: any) => TResult | Promise<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch(onrejected?: (reason: any) => T | Promise<T>): Promise<T>;
|
||||
catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
[Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
@@ -4756,13 +4798,11 @@ interface PromiseConstructor {
|
||||
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param init A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
<T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
@@ -4770,15 +4810,7 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of values.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all(values: Promise<void>[]): Promise<void>;
|
||||
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
@@ -4786,7 +4818,7 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T>(values: (T | Promise<T>)[]): Promise<T>;
|
||||
race<T>(values: Iterable<T | PromiseLike<T>>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
@@ -4807,13 +4839,15 @@ interface PromiseConstructor {
|
||||
* @param value A promise.
|
||||
* @returns A promise whose internal state matches the provided promise.
|
||||
*/
|
||||
resolve<T>(value: T | Promise<T>): Promise<T>;
|
||||
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise .
|
||||
* @returns A resolved promise.
|
||||
*/
|
||||
resolve(): Promise<void>;
|
||||
|
||||
[Symbol.species]: Function;
|
||||
}
|
||||
|
||||
declare var Promise: PromiseConstructor;
|
||||
@@ -8700,6 +8734,8 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.
|
||||
* @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl");
|
||||
*/
|
||||
getContext(contextId: "2d"): CanvasRenderingContext2D;
|
||||
getContext(contextId: "experimental-webgl"): WebGLRenderingContext;
|
||||
getContext(contextId: string, ...args: any[]): CanvasRenderingContext2D | WebGLRenderingContext;
|
||||
/**
|
||||
* Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing.
|
||||
@@ -17181,6 +17217,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
overrideMimeType(mime: string): void;
|
||||
send(data?: Document): void;
|
||||
send(data?: string): void;
|
||||
send(data?: any): void;
|
||||
setRequestHeader(header: string, value: string): void;
|
||||
DONE: number;
|
||||
HEADERS_RECEIVED: number;
|
||||
@@ -17335,11 +17372,13 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"CloseEvent"): CloseEvent;
|
||||
createEvent(eventInterface:"CommandEvent"): CommandEvent;
|
||||
createEvent(eventInterface:"CompositionEvent"): CompositionEvent;
|
||||
createEvent(eventInterface: "CustomEvent"): CustomEvent;
|
||||
createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent;
|
||||
createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent;
|
||||
createEvent(eventInterface:"DragEvent"): DragEvent;
|
||||
createEvent(eventInterface:"ErrorEvent"): ErrorEvent;
|
||||
createEvent(eventInterface:"Event"): Event;
|
||||
createEvent(eventInterface:"Events"): Event;
|
||||
createEvent(eventInterface:"FocusEvent"): FocusEvent;
|
||||
createEvent(eventInterface:"GamepadEvent"): GamepadEvent;
|
||||
createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent;
|
||||
@@ -17354,8 +17393,12 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent;
|
||||
createEvent(eventInterface:"MessageEvent"): MessageEvent;
|
||||
createEvent(eventInterface:"MouseEvent"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseEvents"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent;
|
||||
createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent;
|
||||
createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent;
|
||||
createEvent(eventInterface:"MutationEvent"): MutationEvent;
|
||||
createEvent(eventInterface:"MutationEvents"): MutationEvent;
|
||||
createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent;
|
||||
createEvent(eventInterface:"NavigationEvent"): NavigationEvent;
|
||||
createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer;
|
||||
@@ -17366,6 +17409,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"PopStateEvent"): PopStateEvent;
|
||||
createEvent(eventInterface:"ProgressEvent"): ProgressEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent;
|
||||
createEvent(eventInterface:"StorageEvent"): StorageEvent;
|
||||
createEvent(eventInterface:"TextEvent"): TextEvent;
|
||||
@@ -17373,6 +17417,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"TrackEvent"): TrackEvent;
|
||||
createEvent(eventInterface:"TransitionEvent"): TransitionEvent;
|
||||
createEvent(eventInterface:"UIEvent"): UIEvent;
|
||||
createEvent(eventInterface:"UIEvents"): UIEvent;
|
||||
createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent;
|
||||
createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent;
|
||||
createEvent(eventInterface:"WheelEvent"): WheelEvent;
|
||||
|
||||
Vendored
+133
@@ -61,6 +61,139 @@ interface ArrayBufferView {
|
||||
byteOffset: number;
|
||||
}
|
||||
|
||||
interface DataView {
|
||||
buffer: ArrayBuffer;
|
||||
byteLength: number;
|
||||
byteOffset: number;
|
||||
/**
|
||||
* Gets the Float32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getFloat32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Float64 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getFloat64(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Int8 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt8(byteOffset: number): number;
|
||||
|
||||
/**
|
||||
* Gets the Int16 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt16(byteOffset: number, littleEndian: boolean): number;
|
||||
/**
|
||||
* Gets the Int32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint8 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint8(byteOffset: number): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint16 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint16(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Stores an Float32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setFloat32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Float64 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setFloat64(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int8 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
setInt8(byteOffset: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Stores an Int16 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setInt16(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setInt32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint8 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
setUint8(byteOffset: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint16 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setUint16(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
}
|
||||
|
||||
interface DataViewConstructor {
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
|
||||
}
|
||||
declare var DataView: DataViewConstructor;
|
||||
|
||||
/**
|
||||
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
|
||||
+2916
-2180
File diff suppressed because it is too large
Load Diff
+3912
-3028
File diff suppressed because it is too large
Load Diff
Vendored
+222
-129
@@ -140,132 +140,133 @@ declare module "typescript" {
|
||||
DeclareKeyword = 115,
|
||||
GetKeyword = 116,
|
||||
ModuleKeyword = 117,
|
||||
RequireKeyword = 118,
|
||||
NumberKeyword = 119,
|
||||
SetKeyword = 120,
|
||||
StringKeyword = 121,
|
||||
SymbolKeyword = 122,
|
||||
TypeKeyword = 123,
|
||||
FromKeyword = 124,
|
||||
OfKeyword = 125,
|
||||
QualifiedName = 126,
|
||||
ComputedPropertyName = 127,
|
||||
TypeParameter = 128,
|
||||
Parameter = 129,
|
||||
Decorator = 130,
|
||||
PropertySignature = 131,
|
||||
PropertyDeclaration = 132,
|
||||
MethodSignature = 133,
|
||||
MethodDeclaration = 134,
|
||||
Constructor = 135,
|
||||
GetAccessor = 136,
|
||||
SetAccessor = 137,
|
||||
CallSignature = 138,
|
||||
ConstructSignature = 139,
|
||||
IndexSignature = 140,
|
||||
TypeReference = 141,
|
||||
FunctionType = 142,
|
||||
ConstructorType = 143,
|
||||
TypeQuery = 144,
|
||||
TypeLiteral = 145,
|
||||
ArrayType = 146,
|
||||
TupleType = 147,
|
||||
UnionType = 148,
|
||||
ParenthesizedType = 149,
|
||||
ObjectBindingPattern = 150,
|
||||
ArrayBindingPattern = 151,
|
||||
BindingElement = 152,
|
||||
ArrayLiteralExpression = 153,
|
||||
ObjectLiteralExpression = 154,
|
||||
PropertyAccessExpression = 155,
|
||||
ElementAccessExpression = 156,
|
||||
CallExpression = 157,
|
||||
NewExpression = 158,
|
||||
TaggedTemplateExpression = 159,
|
||||
TypeAssertionExpression = 160,
|
||||
ParenthesizedExpression = 161,
|
||||
FunctionExpression = 162,
|
||||
ArrowFunction = 163,
|
||||
DeleteExpression = 164,
|
||||
TypeOfExpression = 165,
|
||||
VoidExpression = 166,
|
||||
PrefixUnaryExpression = 167,
|
||||
PostfixUnaryExpression = 168,
|
||||
BinaryExpression = 169,
|
||||
ConditionalExpression = 170,
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
ClassExpression = 174,
|
||||
OmittedExpression = 175,
|
||||
TemplateSpan = 176,
|
||||
HeritageClauseElement = 177,
|
||||
SemicolonClassElement = 178,
|
||||
Block = 179,
|
||||
VariableStatement = 180,
|
||||
EmptyStatement = 181,
|
||||
ExpressionStatement = 182,
|
||||
IfStatement = 183,
|
||||
DoStatement = 184,
|
||||
WhileStatement = 185,
|
||||
ForStatement = 186,
|
||||
ForInStatement = 187,
|
||||
ForOfStatement = 188,
|
||||
ContinueStatement = 189,
|
||||
BreakStatement = 190,
|
||||
ReturnStatement = 191,
|
||||
WithStatement = 192,
|
||||
SwitchStatement = 193,
|
||||
LabeledStatement = 194,
|
||||
ThrowStatement = 195,
|
||||
TryStatement = 196,
|
||||
DebuggerStatement = 197,
|
||||
VariableDeclaration = 198,
|
||||
VariableDeclarationList = 199,
|
||||
FunctionDeclaration = 200,
|
||||
ClassDeclaration = 201,
|
||||
InterfaceDeclaration = 202,
|
||||
TypeAliasDeclaration = 203,
|
||||
EnumDeclaration = 204,
|
||||
ModuleDeclaration = 205,
|
||||
ModuleBlock = 206,
|
||||
CaseBlock = 207,
|
||||
ImportEqualsDeclaration = 208,
|
||||
ImportDeclaration = 209,
|
||||
ImportClause = 210,
|
||||
NamespaceImport = 211,
|
||||
NamedImports = 212,
|
||||
ImportSpecifier = 213,
|
||||
ExportAssignment = 214,
|
||||
ExportDeclaration = 215,
|
||||
NamedExports = 216,
|
||||
ExportSpecifier = 217,
|
||||
MissingDeclaration = 218,
|
||||
ExternalModuleReference = 219,
|
||||
CaseClause = 220,
|
||||
DefaultClause = 221,
|
||||
HeritageClause = 222,
|
||||
CatchClause = 223,
|
||||
PropertyAssignment = 224,
|
||||
ShorthandPropertyAssignment = 225,
|
||||
EnumMember = 226,
|
||||
SourceFile = 227,
|
||||
SyntaxList = 228,
|
||||
Count = 229,
|
||||
NamespaceKeyword = 118,
|
||||
RequireKeyword = 119,
|
||||
NumberKeyword = 120,
|
||||
SetKeyword = 121,
|
||||
StringKeyword = 122,
|
||||
SymbolKeyword = 123,
|
||||
TypeKeyword = 124,
|
||||
FromKeyword = 125,
|
||||
OfKeyword = 126,
|
||||
QualifiedName = 127,
|
||||
ComputedPropertyName = 128,
|
||||
TypeParameter = 129,
|
||||
Parameter = 130,
|
||||
Decorator = 131,
|
||||
PropertySignature = 132,
|
||||
PropertyDeclaration = 133,
|
||||
MethodSignature = 134,
|
||||
MethodDeclaration = 135,
|
||||
Constructor = 136,
|
||||
GetAccessor = 137,
|
||||
SetAccessor = 138,
|
||||
CallSignature = 139,
|
||||
ConstructSignature = 140,
|
||||
IndexSignature = 141,
|
||||
TypeReference = 142,
|
||||
FunctionType = 143,
|
||||
ConstructorType = 144,
|
||||
TypeQuery = 145,
|
||||
TypeLiteral = 146,
|
||||
ArrayType = 147,
|
||||
TupleType = 148,
|
||||
UnionType = 149,
|
||||
ParenthesizedType = 150,
|
||||
ObjectBindingPattern = 151,
|
||||
ArrayBindingPattern = 152,
|
||||
BindingElement = 153,
|
||||
ArrayLiteralExpression = 154,
|
||||
ObjectLiteralExpression = 155,
|
||||
PropertyAccessExpression = 156,
|
||||
ElementAccessExpression = 157,
|
||||
CallExpression = 158,
|
||||
NewExpression = 159,
|
||||
TaggedTemplateExpression = 160,
|
||||
TypeAssertionExpression = 161,
|
||||
ParenthesizedExpression = 162,
|
||||
FunctionExpression = 163,
|
||||
ArrowFunction = 164,
|
||||
DeleteExpression = 165,
|
||||
TypeOfExpression = 166,
|
||||
VoidExpression = 167,
|
||||
PrefixUnaryExpression = 168,
|
||||
PostfixUnaryExpression = 169,
|
||||
BinaryExpression = 170,
|
||||
ConditionalExpression = 171,
|
||||
TemplateExpression = 172,
|
||||
YieldExpression = 173,
|
||||
SpreadElementExpression = 174,
|
||||
ClassExpression = 175,
|
||||
OmittedExpression = 176,
|
||||
ExpressionWithTypeArguments = 177,
|
||||
TemplateSpan = 178,
|
||||
SemicolonClassElement = 179,
|
||||
Block = 180,
|
||||
VariableStatement = 181,
|
||||
EmptyStatement = 182,
|
||||
ExpressionStatement = 183,
|
||||
IfStatement = 184,
|
||||
DoStatement = 185,
|
||||
WhileStatement = 186,
|
||||
ForStatement = 187,
|
||||
ForInStatement = 188,
|
||||
ForOfStatement = 189,
|
||||
ContinueStatement = 190,
|
||||
BreakStatement = 191,
|
||||
ReturnStatement = 192,
|
||||
WithStatement = 193,
|
||||
SwitchStatement = 194,
|
||||
LabeledStatement = 195,
|
||||
ThrowStatement = 196,
|
||||
TryStatement = 197,
|
||||
DebuggerStatement = 198,
|
||||
VariableDeclaration = 199,
|
||||
VariableDeclarationList = 200,
|
||||
FunctionDeclaration = 201,
|
||||
ClassDeclaration = 202,
|
||||
InterfaceDeclaration = 203,
|
||||
TypeAliasDeclaration = 204,
|
||||
EnumDeclaration = 205,
|
||||
ModuleDeclaration = 206,
|
||||
ModuleBlock = 207,
|
||||
CaseBlock = 208,
|
||||
ImportEqualsDeclaration = 209,
|
||||
ImportDeclaration = 210,
|
||||
ImportClause = 211,
|
||||
NamespaceImport = 212,
|
||||
NamedImports = 213,
|
||||
ImportSpecifier = 214,
|
||||
ExportAssignment = 215,
|
||||
ExportDeclaration = 216,
|
||||
NamedExports = 217,
|
||||
ExportSpecifier = 218,
|
||||
MissingDeclaration = 219,
|
||||
ExternalModuleReference = 220,
|
||||
CaseClause = 221,
|
||||
DefaultClause = 222,
|
||||
HeritageClause = 223,
|
||||
CatchClause = 224,
|
||||
PropertyAssignment = 225,
|
||||
ShorthandPropertyAssignment = 226,
|
||||
EnumMember = 227,
|
||||
SourceFile = 228,
|
||||
SyntaxList = 229,
|
||||
Count = 230,
|
||||
FirstAssignment = 53,
|
||||
LastAssignment = 64,
|
||||
FirstReservedWord = 66,
|
||||
LastReservedWord = 101,
|
||||
FirstKeyword = 66,
|
||||
LastKeyword = 125,
|
||||
LastKeyword = 126,
|
||||
FirstFutureReservedWord = 102,
|
||||
LastFutureReservedWord = 110,
|
||||
FirstTypeNode = 141,
|
||||
LastTypeNode = 149,
|
||||
FirstTypeNode = 142,
|
||||
LastTypeNode = 150,
|
||||
FirstPunctuation = 14,
|
||||
LastPunctuation = 64,
|
||||
FirstToken = 0,
|
||||
LastToken = 125,
|
||||
LastToken = 126,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 6,
|
||||
FirstLiteralToken = 7,
|
||||
@@ -274,7 +275,7 @@ declare module "typescript" {
|
||||
LastTemplateToken = 13,
|
||||
FirstBinaryOperator = 24,
|
||||
LastBinaryOperator = 64,
|
||||
FirstNode = 126,
|
||||
FirstNode = 127,
|
||||
}
|
||||
const enum NodeFlags {
|
||||
Export = 1,
|
||||
@@ -290,7 +291,8 @@ declare module "typescript" {
|
||||
Let = 4096,
|
||||
Const = 8192,
|
||||
OctalLiteral = 16384,
|
||||
ExportContext = 32768,
|
||||
Namespace = 32768,
|
||||
ExportContext = 65536,
|
||||
Modifier = 499,
|
||||
AccessibilityModifier = 112,
|
||||
BlockScoped = 12288,
|
||||
@@ -553,7 +555,7 @@ declare module "typescript" {
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
arguments: NodeArray<Expression>;
|
||||
}
|
||||
interface HeritageClauseElement extends TypeNode {
|
||||
interface ExpressionWithTypeArguments extends TypeNode {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
}
|
||||
@@ -597,7 +599,7 @@ declare module "typescript" {
|
||||
interface ForStatement extends IterationStatement {
|
||||
initializer?: VariableDeclarationList | Expression;
|
||||
condition?: Expression;
|
||||
iterator?: Expression;
|
||||
incrementor?: Expression;
|
||||
}
|
||||
interface ForInStatement extends IterationStatement {
|
||||
initializer: VariableDeclarationList | Expression;
|
||||
@@ -672,7 +674,7 @@ declare module "typescript" {
|
||||
}
|
||||
interface HeritageClause extends Node {
|
||||
token: SyntaxKind;
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
types?: NodeArray<ExpressionWithTypeArguments>;
|
||||
}
|
||||
interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
@@ -756,6 +758,9 @@ declare module "typescript" {
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
getCurrentDirectory(): string;
|
||||
}
|
||||
interface ParseConfigHost {
|
||||
readDirectory(rootDir: string, extension: string): string[];
|
||||
}
|
||||
interface WriteFileCallback {
|
||||
(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
|
||||
}
|
||||
@@ -804,6 +809,7 @@ declare module "typescript" {
|
||||
sourceMapFile: string;
|
||||
sourceMapSourceRoot: string;
|
||||
sourceMapSources: string[];
|
||||
sourceMapSourcesContent?: string[];
|
||||
inputSourceFileNames: string[];
|
||||
sourceMapNames?: string[];
|
||||
sourceMapMappings: string;
|
||||
@@ -1005,15 +1011,17 @@ declare module "typescript" {
|
||||
}
|
||||
interface InterfaceType extends ObjectType {
|
||||
typeParameters: TypeParameter[];
|
||||
}
|
||||
interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
|
||||
declaredProperties: Symbol[];
|
||||
declaredCallSignatures: Signature[];
|
||||
declaredConstructSignatures: Signature[];
|
||||
declaredStringIndexType: Type;
|
||||
declaredNumberIndexType: Type;
|
||||
}
|
||||
interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
interface TypeReference extends ObjectType {
|
||||
target: GenericType;
|
||||
typeArguments: Type[];
|
||||
@@ -1080,11 +1088,15 @@ declare module "typescript" {
|
||||
diagnostics?: boolean;
|
||||
emitBOM?: boolean;
|
||||
help?: boolean;
|
||||
inlineSourceMap?: boolean;
|
||||
inlineSources?: boolean;
|
||||
listFiles?: boolean;
|
||||
locale?: string;
|
||||
mapRoot?: string;
|
||||
module?: ModuleKind;
|
||||
newLine?: NewLineKind;
|
||||
noEmit?: boolean;
|
||||
noEmitHelpers?: boolean;
|
||||
noEmitOnError?: boolean;
|
||||
noErrorTruncation?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
@@ -1110,6 +1122,12 @@ declare module "typescript" {
|
||||
None = 0,
|
||||
CommonJS = 1,
|
||||
AMD = 2,
|
||||
UMD = 3,
|
||||
System = 4,
|
||||
}
|
||||
const enum NewLineKind {
|
||||
CarriageReturnLineFeed = 0,
|
||||
LineFeed = 1,
|
||||
}
|
||||
interface LineAndCharacter {
|
||||
line: number;
|
||||
@@ -1173,6 +1191,32 @@ declare module "typescript" {
|
||||
var sys: System;
|
||||
}
|
||||
declare module "typescript" {
|
||||
interface ErrorCallback {
|
||||
(message: DiagnosticMessage, length: number): void;
|
||||
}
|
||||
interface Scanner {
|
||||
getStartPos(): number;
|
||||
getToken(): SyntaxKind;
|
||||
getTextPos(): number;
|
||||
getTokenPos(): number;
|
||||
getTokenText(): string;
|
||||
getTokenValue(): string;
|
||||
hasExtendedUnicodeEscape(): boolean;
|
||||
hasPrecedingLineBreak(): boolean;
|
||||
isIdentifier(): boolean;
|
||||
isReservedWord(): boolean;
|
||||
isUnterminated(): boolean;
|
||||
reScanGreaterToken(): SyntaxKind;
|
||||
reScanSlashToken(): SyntaxKind;
|
||||
reScanTemplateToken(): SyntaxKind;
|
||||
scan(): SyntaxKind;
|
||||
setText(text: string, start?: number, length?: number): void;
|
||||
setOnError(onError: ErrorCallback): void;
|
||||
setScriptTarget(scriptTarget: ScriptTarget): void;
|
||||
setTextPos(textPos: number): void;
|
||||
lookAhead<T>(callback: () => T): T;
|
||||
tryScan<T>(callback: () => T): T;
|
||||
}
|
||||
function tokenToString(t: SyntaxKind): string;
|
||||
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
|
||||
function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
|
||||
@@ -1182,6 +1226,8 @@ declare module "typescript" {
|
||||
function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
|
||||
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
/** Creates a scanner over a (possibly unspecified) range of a piece of text. */
|
||||
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
|
||||
}
|
||||
declare module "typescript" {
|
||||
function getDefaultLibFileName(options: CompilerOptions): string;
|
||||
@@ -1223,7 +1269,7 @@ declare module "typescript" {
|
||||
const version: string;
|
||||
function findConfigFile(searchPath: string): string;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile): Diagnostic[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
|
||||
}
|
||||
@@ -1233,14 +1279,26 @@ declare module "typescript" {
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
function readConfigFile(fileName: string): any;
|
||||
function readConfigFile(fileName: string): {
|
||||
config?: any;
|
||||
error?: Diagnostic;
|
||||
};
|
||||
/**
|
||||
* Parse the text of the tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
* @param jsonText The text of the config file
|
||||
*/
|
||||
function parseConfigFileText(fileName: string, jsonText: string): {
|
||||
config?: any;
|
||||
error?: Diagnostic;
|
||||
};
|
||||
/**
|
||||
* Parse the contents of a config file (tsconfig.json).
|
||||
* @param json The contents of the config file to parse
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
|
||||
function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
|
||||
}
|
||||
declare module "typescript" {
|
||||
/** The version of the language service API */
|
||||
@@ -1337,8 +1395,16 @@ declare module "typescript" {
|
||||
getSyntacticDiagnostics(fileName: string): Diagnostic[];
|
||||
getSemanticDiagnostics(fileName: string): Diagnostic[];
|
||||
getCompilerOptionsDiagnostics(): Diagnostic[];
|
||||
/**
|
||||
* @deprecated Use getEncodedSyntacticClassifications instead.
|
||||
*/
|
||||
getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
|
||||
/**
|
||||
* @deprecated Use getEncodedSemanticClassifications instead.
|
||||
*/
|
||||
getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
|
||||
getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
|
||||
getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
|
||||
getCompletionsAtPosition(fileName: string, position: number): CompletionInfo;
|
||||
getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails;
|
||||
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
|
||||
@@ -1348,6 +1414,7 @@ declare module "typescript" {
|
||||
getRenameInfo(fileName: string, position: number): RenameInfo;
|
||||
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
|
||||
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
findReferences(fileName: string, position: number): ReferencedSymbol[];
|
||||
getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[];
|
||||
@@ -1367,6 +1434,10 @@ declare module "typescript" {
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
dispose(): void;
|
||||
}
|
||||
interface Classifications {
|
||||
spans: number[];
|
||||
endOfLineState: EndOfLineState;
|
||||
}
|
||||
interface ClassifiedSpan {
|
||||
textSpan: TextSpan;
|
||||
classificationType: string;
|
||||
@@ -1578,7 +1649,7 @@ declare module "typescript" {
|
||||
text: string;
|
||||
}
|
||||
const enum EndOfLineState {
|
||||
Start = 0,
|
||||
None = 0,
|
||||
InMultiLineCommentTrivia = 1,
|
||||
InSingleQuoteStringLiteral = 2,
|
||||
InDoubleQuoteStringLiteral = 3,
|
||||
@@ -1624,8 +1695,10 @@ declare module "typescript" {
|
||||
* classifications which may be incorrectly categorized will be given
|
||||
* back as Identifiers in order to allow the syntactic classifier to
|
||||
* subsume the classification.
|
||||
* @deprecated Use getLexicalClassifications instead.
|
||||
*/
|
||||
getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
|
||||
getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
|
||||
}
|
||||
/**
|
||||
* The document registry represents a store of SourceFile objects that can be shared between
|
||||
@@ -1736,7 +1809,27 @@ declare module "typescript" {
|
||||
static interfaceName: string;
|
||||
static moduleName: string;
|
||||
static typeParameterName: string;
|
||||
static typeAlias: string;
|
||||
static typeAliasName: string;
|
||||
static parameterName: string;
|
||||
}
|
||||
const enum ClassificationType {
|
||||
comment = 1,
|
||||
identifier = 2,
|
||||
keyword = 3,
|
||||
numericLiteral = 4,
|
||||
operator = 5,
|
||||
stringLiteral = 6,
|
||||
regularExpressionLiteral = 7,
|
||||
whiteSpace = 8,
|
||||
text = 9,
|
||||
punctuation = 10,
|
||||
className = 11,
|
||||
enumName = 12,
|
||||
interfaceName = 13,
|
||||
moduleName = 14,
|
||||
typeParameterName = 15,
|
||||
typeAliasName = 16,
|
||||
parameterName = 17,
|
||||
}
|
||||
interface DisplayPartsSymbolWriter extends SymbolWriter {
|
||||
displayParts(): SymbolDisplayPart[];
|
||||
|
||||
+4576
-3485
File diff suppressed because it is too large
Load Diff
Vendored
+222
-129
@@ -140,132 +140,133 @@ declare module ts {
|
||||
DeclareKeyword = 115,
|
||||
GetKeyword = 116,
|
||||
ModuleKeyword = 117,
|
||||
RequireKeyword = 118,
|
||||
NumberKeyword = 119,
|
||||
SetKeyword = 120,
|
||||
StringKeyword = 121,
|
||||
SymbolKeyword = 122,
|
||||
TypeKeyword = 123,
|
||||
FromKeyword = 124,
|
||||
OfKeyword = 125,
|
||||
QualifiedName = 126,
|
||||
ComputedPropertyName = 127,
|
||||
TypeParameter = 128,
|
||||
Parameter = 129,
|
||||
Decorator = 130,
|
||||
PropertySignature = 131,
|
||||
PropertyDeclaration = 132,
|
||||
MethodSignature = 133,
|
||||
MethodDeclaration = 134,
|
||||
Constructor = 135,
|
||||
GetAccessor = 136,
|
||||
SetAccessor = 137,
|
||||
CallSignature = 138,
|
||||
ConstructSignature = 139,
|
||||
IndexSignature = 140,
|
||||
TypeReference = 141,
|
||||
FunctionType = 142,
|
||||
ConstructorType = 143,
|
||||
TypeQuery = 144,
|
||||
TypeLiteral = 145,
|
||||
ArrayType = 146,
|
||||
TupleType = 147,
|
||||
UnionType = 148,
|
||||
ParenthesizedType = 149,
|
||||
ObjectBindingPattern = 150,
|
||||
ArrayBindingPattern = 151,
|
||||
BindingElement = 152,
|
||||
ArrayLiteralExpression = 153,
|
||||
ObjectLiteralExpression = 154,
|
||||
PropertyAccessExpression = 155,
|
||||
ElementAccessExpression = 156,
|
||||
CallExpression = 157,
|
||||
NewExpression = 158,
|
||||
TaggedTemplateExpression = 159,
|
||||
TypeAssertionExpression = 160,
|
||||
ParenthesizedExpression = 161,
|
||||
FunctionExpression = 162,
|
||||
ArrowFunction = 163,
|
||||
DeleteExpression = 164,
|
||||
TypeOfExpression = 165,
|
||||
VoidExpression = 166,
|
||||
PrefixUnaryExpression = 167,
|
||||
PostfixUnaryExpression = 168,
|
||||
BinaryExpression = 169,
|
||||
ConditionalExpression = 170,
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
ClassExpression = 174,
|
||||
OmittedExpression = 175,
|
||||
TemplateSpan = 176,
|
||||
HeritageClauseElement = 177,
|
||||
SemicolonClassElement = 178,
|
||||
Block = 179,
|
||||
VariableStatement = 180,
|
||||
EmptyStatement = 181,
|
||||
ExpressionStatement = 182,
|
||||
IfStatement = 183,
|
||||
DoStatement = 184,
|
||||
WhileStatement = 185,
|
||||
ForStatement = 186,
|
||||
ForInStatement = 187,
|
||||
ForOfStatement = 188,
|
||||
ContinueStatement = 189,
|
||||
BreakStatement = 190,
|
||||
ReturnStatement = 191,
|
||||
WithStatement = 192,
|
||||
SwitchStatement = 193,
|
||||
LabeledStatement = 194,
|
||||
ThrowStatement = 195,
|
||||
TryStatement = 196,
|
||||
DebuggerStatement = 197,
|
||||
VariableDeclaration = 198,
|
||||
VariableDeclarationList = 199,
|
||||
FunctionDeclaration = 200,
|
||||
ClassDeclaration = 201,
|
||||
InterfaceDeclaration = 202,
|
||||
TypeAliasDeclaration = 203,
|
||||
EnumDeclaration = 204,
|
||||
ModuleDeclaration = 205,
|
||||
ModuleBlock = 206,
|
||||
CaseBlock = 207,
|
||||
ImportEqualsDeclaration = 208,
|
||||
ImportDeclaration = 209,
|
||||
ImportClause = 210,
|
||||
NamespaceImport = 211,
|
||||
NamedImports = 212,
|
||||
ImportSpecifier = 213,
|
||||
ExportAssignment = 214,
|
||||
ExportDeclaration = 215,
|
||||
NamedExports = 216,
|
||||
ExportSpecifier = 217,
|
||||
MissingDeclaration = 218,
|
||||
ExternalModuleReference = 219,
|
||||
CaseClause = 220,
|
||||
DefaultClause = 221,
|
||||
HeritageClause = 222,
|
||||
CatchClause = 223,
|
||||
PropertyAssignment = 224,
|
||||
ShorthandPropertyAssignment = 225,
|
||||
EnumMember = 226,
|
||||
SourceFile = 227,
|
||||
SyntaxList = 228,
|
||||
Count = 229,
|
||||
NamespaceKeyword = 118,
|
||||
RequireKeyword = 119,
|
||||
NumberKeyword = 120,
|
||||
SetKeyword = 121,
|
||||
StringKeyword = 122,
|
||||
SymbolKeyword = 123,
|
||||
TypeKeyword = 124,
|
||||
FromKeyword = 125,
|
||||
OfKeyword = 126,
|
||||
QualifiedName = 127,
|
||||
ComputedPropertyName = 128,
|
||||
TypeParameter = 129,
|
||||
Parameter = 130,
|
||||
Decorator = 131,
|
||||
PropertySignature = 132,
|
||||
PropertyDeclaration = 133,
|
||||
MethodSignature = 134,
|
||||
MethodDeclaration = 135,
|
||||
Constructor = 136,
|
||||
GetAccessor = 137,
|
||||
SetAccessor = 138,
|
||||
CallSignature = 139,
|
||||
ConstructSignature = 140,
|
||||
IndexSignature = 141,
|
||||
TypeReference = 142,
|
||||
FunctionType = 143,
|
||||
ConstructorType = 144,
|
||||
TypeQuery = 145,
|
||||
TypeLiteral = 146,
|
||||
ArrayType = 147,
|
||||
TupleType = 148,
|
||||
UnionType = 149,
|
||||
ParenthesizedType = 150,
|
||||
ObjectBindingPattern = 151,
|
||||
ArrayBindingPattern = 152,
|
||||
BindingElement = 153,
|
||||
ArrayLiteralExpression = 154,
|
||||
ObjectLiteralExpression = 155,
|
||||
PropertyAccessExpression = 156,
|
||||
ElementAccessExpression = 157,
|
||||
CallExpression = 158,
|
||||
NewExpression = 159,
|
||||
TaggedTemplateExpression = 160,
|
||||
TypeAssertionExpression = 161,
|
||||
ParenthesizedExpression = 162,
|
||||
FunctionExpression = 163,
|
||||
ArrowFunction = 164,
|
||||
DeleteExpression = 165,
|
||||
TypeOfExpression = 166,
|
||||
VoidExpression = 167,
|
||||
PrefixUnaryExpression = 168,
|
||||
PostfixUnaryExpression = 169,
|
||||
BinaryExpression = 170,
|
||||
ConditionalExpression = 171,
|
||||
TemplateExpression = 172,
|
||||
YieldExpression = 173,
|
||||
SpreadElementExpression = 174,
|
||||
ClassExpression = 175,
|
||||
OmittedExpression = 176,
|
||||
ExpressionWithTypeArguments = 177,
|
||||
TemplateSpan = 178,
|
||||
SemicolonClassElement = 179,
|
||||
Block = 180,
|
||||
VariableStatement = 181,
|
||||
EmptyStatement = 182,
|
||||
ExpressionStatement = 183,
|
||||
IfStatement = 184,
|
||||
DoStatement = 185,
|
||||
WhileStatement = 186,
|
||||
ForStatement = 187,
|
||||
ForInStatement = 188,
|
||||
ForOfStatement = 189,
|
||||
ContinueStatement = 190,
|
||||
BreakStatement = 191,
|
||||
ReturnStatement = 192,
|
||||
WithStatement = 193,
|
||||
SwitchStatement = 194,
|
||||
LabeledStatement = 195,
|
||||
ThrowStatement = 196,
|
||||
TryStatement = 197,
|
||||
DebuggerStatement = 198,
|
||||
VariableDeclaration = 199,
|
||||
VariableDeclarationList = 200,
|
||||
FunctionDeclaration = 201,
|
||||
ClassDeclaration = 202,
|
||||
InterfaceDeclaration = 203,
|
||||
TypeAliasDeclaration = 204,
|
||||
EnumDeclaration = 205,
|
||||
ModuleDeclaration = 206,
|
||||
ModuleBlock = 207,
|
||||
CaseBlock = 208,
|
||||
ImportEqualsDeclaration = 209,
|
||||
ImportDeclaration = 210,
|
||||
ImportClause = 211,
|
||||
NamespaceImport = 212,
|
||||
NamedImports = 213,
|
||||
ImportSpecifier = 214,
|
||||
ExportAssignment = 215,
|
||||
ExportDeclaration = 216,
|
||||
NamedExports = 217,
|
||||
ExportSpecifier = 218,
|
||||
MissingDeclaration = 219,
|
||||
ExternalModuleReference = 220,
|
||||
CaseClause = 221,
|
||||
DefaultClause = 222,
|
||||
HeritageClause = 223,
|
||||
CatchClause = 224,
|
||||
PropertyAssignment = 225,
|
||||
ShorthandPropertyAssignment = 226,
|
||||
EnumMember = 227,
|
||||
SourceFile = 228,
|
||||
SyntaxList = 229,
|
||||
Count = 230,
|
||||
FirstAssignment = 53,
|
||||
LastAssignment = 64,
|
||||
FirstReservedWord = 66,
|
||||
LastReservedWord = 101,
|
||||
FirstKeyword = 66,
|
||||
LastKeyword = 125,
|
||||
LastKeyword = 126,
|
||||
FirstFutureReservedWord = 102,
|
||||
LastFutureReservedWord = 110,
|
||||
FirstTypeNode = 141,
|
||||
LastTypeNode = 149,
|
||||
FirstTypeNode = 142,
|
||||
LastTypeNode = 150,
|
||||
FirstPunctuation = 14,
|
||||
LastPunctuation = 64,
|
||||
FirstToken = 0,
|
||||
LastToken = 125,
|
||||
LastToken = 126,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 6,
|
||||
FirstLiteralToken = 7,
|
||||
@@ -274,7 +275,7 @@ declare module ts {
|
||||
LastTemplateToken = 13,
|
||||
FirstBinaryOperator = 24,
|
||||
LastBinaryOperator = 64,
|
||||
FirstNode = 126,
|
||||
FirstNode = 127,
|
||||
}
|
||||
const enum NodeFlags {
|
||||
Export = 1,
|
||||
@@ -290,7 +291,8 @@ declare module ts {
|
||||
Let = 4096,
|
||||
Const = 8192,
|
||||
OctalLiteral = 16384,
|
||||
ExportContext = 32768,
|
||||
Namespace = 32768,
|
||||
ExportContext = 65536,
|
||||
Modifier = 499,
|
||||
AccessibilityModifier = 112,
|
||||
BlockScoped = 12288,
|
||||
@@ -553,7 +555,7 @@ declare module ts {
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
arguments: NodeArray<Expression>;
|
||||
}
|
||||
interface HeritageClauseElement extends TypeNode {
|
||||
interface ExpressionWithTypeArguments extends TypeNode {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
}
|
||||
@@ -597,7 +599,7 @@ declare module ts {
|
||||
interface ForStatement extends IterationStatement {
|
||||
initializer?: VariableDeclarationList | Expression;
|
||||
condition?: Expression;
|
||||
iterator?: Expression;
|
||||
incrementor?: Expression;
|
||||
}
|
||||
interface ForInStatement extends IterationStatement {
|
||||
initializer: VariableDeclarationList | Expression;
|
||||
@@ -672,7 +674,7 @@ declare module ts {
|
||||
}
|
||||
interface HeritageClause extends Node {
|
||||
token: SyntaxKind;
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
types?: NodeArray<ExpressionWithTypeArguments>;
|
||||
}
|
||||
interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
@@ -756,6 +758,9 @@ declare module ts {
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
getCurrentDirectory(): string;
|
||||
}
|
||||
interface ParseConfigHost {
|
||||
readDirectory(rootDir: string, extension: string): string[];
|
||||
}
|
||||
interface WriteFileCallback {
|
||||
(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
|
||||
}
|
||||
@@ -804,6 +809,7 @@ declare module ts {
|
||||
sourceMapFile: string;
|
||||
sourceMapSourceRoot: string;
|
||||
sourceMapSources: string[];
|
||||
sourceMapSourcesContent?: string[];
|
||||
inputSourceFileNames: string[];
|
||||
sourceMapNames?: string[];
|
||||
sourceMapMappings: string;
|
||||
@@ -1005,15 +1011,17 @@ declare module ts {
|
||||
}
|
||||
interface InterfaceType extends ObjectType {
|
||||
typeParameters: TypeParameter[];
|
||||
}
|
||||
interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
|
||||
declaredProperties: Symbol[];
|
||||
declaredCallSignatures: Signature[];
|
||||
declaredConstructSignatures: Signature[];
|
||||
declaredStringIndexType: Type;
|
||||
declaredNumberIndexType: Type;
|
||||
}
|
||||
interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
interface TypeReference extends ObjectType {
|
||||
target: GenericType;
|
||||
typeArguments: Type[];
|
||||
@@ -1080,11 +1088,15 @@ declare module ts {
|
||||
diagnostics?: boolean;
|
||||
emitBOM?: boolean;
|
||||
help?: boolean;
|
||||
inlineSourceMap?: boolean;
|
||||
inlineSources?: boolean;
|
||||
listFiles?: boolean;
|
||||
locale?: string;
|
||||
mapRoot?: string;
|
||||
module?: ModuleKind;
|
||||
newLine?: NewLineKind;
|
||||
noEmit?: boolean;
|
||||
noEmitHelpers?: boolean;
|
||||
noEmitOnError?: boolean;
|
||||
noErrorTruncation?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
@@ -1110,6 +1122,12 @@ declare module ts {
|
||||
None = 0,
|
||||
CommonJS = 1,
|
||||
AMD = 2,
|
||||
UMD = 3,
|
||||
System = 4,
|
||||
}
|
||||
const enum NewLineKind {
|
||||
CarriageReturnLineFeed = 0,
|
||||
LineFeed = 1,
|
||||
}
|
||||
interface LineAndCharacter {
|
||||
line: number;
|
||||
@@ -1173,6 +1191,32 @@ declare module ts {
|
||||
var sys: System;
|
||||
}
|
||||
declare module ts {
|
||||
interface ErrorCallback {
|
||||
(message: DiagnosticMessage, length: number): void;
|
||||
}
|
||||
interface Scanner {
|
||||
getStartPos(): number;
|
||||
getToken(): SyntaxKind;
|
||||
getTextPos(): number;
|
||||
getTokenPos(): number;
|
||||
getTokenText(): string;
|
||||
getTokenValue(): string;
|
||||
hasExtendedUnicodeEscape(): boolean;
|
||||
hasPrecedingLineBreak(): boolean;
|
||||
isIdentifier(): boolean;
|
||||
isReservedWord(): boolean;
|
||||
isUnterminated(): boolean;
|
||||
reScanGreaterToken(): SyntaxKind;
|
||||
reScanSlashToken(): SyntaxKind;
|
||||
reScanTemplateToken(): SyntaxKind;
|
||||
scan(): SyntaxKind;
|
||||
setText(text: string, start?: number, length?: number): void;
|
||||
setOnError(onError: ErrorCallback): void;
|
||||
setScriptTarget(scriptTarget: ScriptTarget): void;
|
||||
setTextPos(textPos: number): void;
|
||||
lookAhead<T>(callback: () => T): T;
|
||||
tryScan<T>(callback: () => T): T;
|
||||
}
|
||||
function tokenToString(t: SyntaxKind): string;
|
||||
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
|
||||
function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
|
||||
@@ -1182,6 +1226,8 @@ declare module ts {
|
||||
function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
|
||||
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
/** Creates a scanner over a (possibly unspecified) range of a piece of text. */
|
||||
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
|
||||
}
|
||||
declare module ts {
|
||||
function getDefaultLibFileName(options: CompilerOptions): string;
|
||||
@@ -1223,7 +1269,7 @@ declare module ts {
|
||||
const version: string;
|
||||
function findConfigFile(searchPath: string): string;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile): Diagnostic[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
|
||||
}
|
||||
@@ -1233,14 +1279,26 @@ declare module ts {
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
function readConfigFile(fileName: string): any;
|
||||
function readConfigFile(fileName: string): {
|
||||
config?: any;
|
||||
error?: Diagnostic;
|
||||
};
|
||||
/**
|
||||
* Parse the text of the tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
* @param jsonText The text of the config file
|
||||
*/
|
||||
function parseConfigFileText(fileName: string, jsonText: string): {
|
||||
config?: any;
|
||||
error?: Diagnostic;
|
||||
};
|
||||
/**
|
||||
* Parse the contents of a config file (tsconfig.json).
|
||||
* @param json The contents of the config file to parse
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
|
||||
function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
|
||||
}
|
||||
declare module ts {
|
||||
/** The version of the language service API */
|
||||
@@ -1337,8 +1395,16 @@ declare module ts {
|
||||
getSyntacticDiagnostics(fileName: string): Diagnostic[];
|
||||
getSemanticDiagnostics(fileName: string): Diagnostic[];
|
||||
getCompilerOptionsDiagnostics(): Diagnostic[];
|
||||
/**
|
||||
* @deprecated Use getEncodedSyntacticClassifications instead.
|
||||
*/
|
||||
getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
|
||||
/**
|
||||
* @deprecated Use getEncodedSemanticClassifications instead.
|
||||
*/
|
||||
getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
|
||||
getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
|
||||
getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
|
||||
getCompletionsAtPosition(fileName: string, position: number): CompletionInfo;
|
||||
getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails;
|
||||
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
|
||||
@@ -1348,6 +1414,7 @@ declare module ts {
|
||||
getRenameInfo(fileName: string, position: number): RenameInfo;
|
||||
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
|
||||
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
findReferences(fileName: string, position: number): ReferencedSymbol[];
|
||||
getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[];
|
||||
@@ -1367,6 +1434,10 @@ declare module ts {
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
dispose(): void;
|
||||
}
|
||||
interface Classifications {
|
||||
spans: number[];
|
||||
endOfLineState: EndOfLineState;
|
||||
}
|
||||
interface ClassifiedSpan {
|
||||
textSpan: TextSpan;
|
||||
classificationType: string;
|
||||
@@ -1578,7 +1649,7 @@ declare module ts {
|
||||
text: string;
|
||||
}
|
||||
const enum EndOfLineState {
|
||||
Start = 0,
|
||||
None = 0,
|
||||
InMultiLineCommentTrivia = 1,
|
||||
InSingleQuoteStringLiteral = 2,
|
||||
InDoubleQuoteStringLiteral = 3,
|
||||
@@ -1624,8 +1695,10 @@ declare module ts {
|
||||
* classifications which may be incorrectly categorized will be given
|
||||
* back as Identifiers in order to allow the syntactic classifier to
|
||||
* subsume the classification.
|
||||
* @deprecated Use getLexicalClassifications instead.
|
||||
*/
|
||||
getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
|
||||
getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
|
||||
}
|
||||
/**
|
||||
* The document registry represents a store of SourceFile objects that can be shared between
|
||||
@@ -1736,7 +1809,27 @@ declare module ts {
|
||||
static interfaceName: string;
|
||||
static moduleName: string;
|
||||
static typeParameterName: string;
|
||||
static typeAlias: string;
|
||||
static typeAliasName: string;
|
||||
static parameterName: string;
|
||||
}
|
||||
const enum ClassificationType {
|
||||
comment = 1,
|
||||
identifier = 2,
|
||||
keyword = 3,
|
||||
numericLiteral = 4,
|
||||
operator = 5,
|
||||
stringLiteral = 6,
|
||||
regularExpressionLiteral = 7,
|
||||
whiteSpace = 8,
|
||||
text = 9,
|
||||
punctuation = 10,
|
||||
className = 11,
|
||||
enumName = 12,
|
||||
interfaceName = 13,
|
||||
moduleName = 14,
|
||||
typeParameterName = 15,
|
||||
typeAliasName = 16,
|
||||
parameterName = 17,
|
||||
}
|
||||
interface DisplayPartsSymbolWriter extends SymbolWriter {
|
||||
displayParts(): SymbolDisplayPart[];
|
||||
|
||||
+4576
-3485
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg version="1.1" id="logo-typescript" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 283.09 69.57">
|
||||
<g fill="#007ACC">
|
||||
<path d="M34.98 7.56H20.43v45.07h-5.91V7.56H0V2.21h34.98V7.56z"/>
|
||||
<path d="M57.94 16.63L41.38 58.39c-2.95 7.45-7.1 11.18-12.45 11.18 -1.5 0-2.75-0.15-3.76-0.46v-5.17c1.24 0.42 2.38 0.63 3.41 0.63 2.91 0 5.09-1.73 6.54-5.2l2.88-6.82L23.94 16.63h6.4l9.74 27.7c0.12 0.35 0.36 1.27 0.74 2.74h0.21c0.12-0.56 0.35-1.45 0.7-2.67l10.23-27.77H57.94z"/>
|
||||
<path d="M67.37 47.43h-0.14v21.76h-5.77V16.63h5.77v6.33h0.14c2.84-4.78 6.98-7.17 12.45-7.17 4.64 0 8.26 1.61 10.86 4.83 2.6 3.22 3.9 7.54 3.9 12.96 0 6.02-1.46 10.85-4.39 14.47 -2.93 3.62-6.94 5.43-12.02 5.43C73.5 53.47 69.9 51.46 67.37 47.43zM67.23 32.91v5.03c0 2.98 0.97 5.5 2.9 7.58s4.39 3.11 7.37 3.11c3.49 0 6.23-1.34 8.21-4.01 1.98-2.67 2.97-6.39 2.97-11.14 0-4.01-0.93-7.15-2.78-9.42 -1.85-2.27-4.36-3.41-7.52-3.41 -3.35 0-6.05 1.17-8.09 3.5C68.25 26.47 67.23 29.39 67.23 32.91z"/>
|
||||
<path d="M129.56 36.07h-25.42c0.09 4.01 1.17 7.1 3.23 9.28 2.06 2.18 4.9 3.27 8.51 3.27 4.05 0 7.78-1.34 11.18-4.01v5.41c-3.16 2.3-7.35 3.45-12.55 3.45 -5.09 0-9.08-1.63-11.99-4.9 -2.91-3.27-4.36-7.87-4.36-13.8 0-5.6 1.59-10.17 4.76-13.69 3.18-3.53 7.12-5.29 11.83-5.29s8.35 1.52 10.93 4.57c2.58 3.05 3.87 7.28 3.87 12.69V36.07zM123.65 31.18c-0.02-3.33-0.83-5.92-2.41-7.77 -1.58-1.85-3.78-2.78-6.59-2.78 -2.72 0-5.03 0.97-6.93 2.92 -1.9 1.95-3.07 4.49-3.52 7.63H123.65z"/>
|
||||
<path d="M134.6 50.59v-6.96c0.73 0.7 1.6 1.34 2.62 1.9 1.02 0.56 2.09 1.04 3.22 1.42s2.26 0.69 3.39 0.9c1.14 0.21 2.19 0.32 3.15 0.32 3.32 0 5.81-0.67 7.45-2.02 1.64-1.35 2.46-3.29 2.46-5.82 0-1.36-0.27-2.54-0.82-3.55 -0.55-1.01-1.3-1.93-2.27-2.76s-2.11-1.63-3.43-2.39c-1.32-0.76-2.74-1.56-4.26-2.41 -1.61-0.89-3.11-1.79-4.5-2.71 -1.39-0.91-2.61-1.92-3.63-3.02 -1.03-1.1-1.84-2.35-2.43-3.74 -0.59-1.39-0.88-3.03-0.88-4.9 0-2.3 0.46-4.29 1.38-5.99 0.92-1.7 2.13-3.1 3.64-4.2 1.5-1.1 3.21-1.92 5.13-2.46 1.92-0.54 3.88-0.81 5.87-0.81 4.55 0 7.86 0.6 9.94 1.79v6.64c-2.72-2.06-6.22-3.09-10.49-3.09 -1.18 0-2.36 0.14-3.54 0.4 -1.18 0.27-2.23 0.71-3.15 1.32 -0.92 0.61-1.67 1.39-2.25 2.36 -0.58 0.96-0.87 2.13-0.87 3.52 0 1.29 0.22 2.4 0.66 3.34 0.44 0.94 1.09 1.79 1.95 2.57 0.86 0.77 1.9 1.52 3.14 2.25 1.23 0.73 2.65 1.52 4.26 2.39 1.65 0.89 3.22 1.83 4.7 2.81s2.78 2.07 3.89 3.27c1.11 1.2 2 2.52 2.65 3.97 0.65 1.45 0.98 3.12 0.98 4.99 0 2.48-0.45 4.59-1.33 6.31 -0.89 1.72-2.09 3.12-3.6 4.2 -1.51 1.08-3.25 1.86-5.23 2.34 -1.97 0.48-4.05 0.72-6.24 0.72 -0.73 0-1.63-0.06-2.7-0.19s-2.17-0.32-3.28-0.56c-1.12-0.25-2.17-0.55-3.17-0.91C136 51.44 135.21 51.03 134.6 50.59z"/>
|
||||
<path d="M193.25 50.98c-2.77 1.66-6.05 2.5-9.84 2.5 -5.13 0-9.28-1.67-12.43-5.01s-4.73-7.67-4.73-12.99c0-5.93 1.7-10.69 5.1-14.29 3.4-3.6 7.93-5.4 13.61-5.4 3.16 0 5.95 0.59 8.37 1.76v5.91c-2.67-1.88-5.53-2.81-8.58-2.81 -3.68 0-6.7 1.32-9.05 3.96s-3.53 6.1-3.53 10.39c0 4.22 1.11 7.55 3.32 9.98s5.19 3.66 8.91 3.66c3.14 0 6.09-1.04 8.86-3.13V50.98z"/>
|
||||
<path d="M215.56 22.46c-1.01-0.77-2.46-1.16-4.36-1.16 -2.46 0-4.52 1.16-6.17 3.48s-2.48 5.48-2.48 9.49v18.35h-5.77v-36h5.77v7.42h0.14c0.82-2.53 2.07-4.51 3.76-5.92 1.69-1.42 3.57-2.13 5.66-2.13 1.5 0 2.65 0.16 3.45 0.49V22.46z"/>
|
||||
<path d="M222.18 7.49c-1.03 0-1.91-0.35-2.64-1.05s-1.09-1.59-1.09-2.67c0-1.08 0.36-1.97 1.09-2.69 0.73-0.71 1.61-1.07 2.64-1.07 1.05 0 1.95 0.36 2.69 1.07 0.74 0.72 1.11 1.61 1.11 2.69 0 1.03-0.37 1.91-1.11 2.64C224.13 7.12 223.23 7.49 222.18 7.49zM224.99 52.63h-5.77v-36h5.77V52.63z"/>
|
||||
<path d="M234.29 47.43h-0.14v21.76h-5.77V16.63h5.77v6.33h0.14c2.84-4.78 6.98-7.17 12.45-7.17 4.64 0 8.26 1.61 10.86 4.83 2.6 3.22 3.9 7.54 3.9 12.96 0 6.02-1.46 10.85-4.39 14.47s-6.94 5.43-12.02 5.43C240.42 53.47 236.82 51.46 234.29 47.43zM234.15 32.91v5.03c0 2.98 0.97 5.5 2.9 7.58s4.39 3.11 7.37 3.11c3.49 0 6.23-1.34 8.21-4.01s2.97-6.39 2.97-11.14c0-4.01-0.93-7.15-2.78-9.42 -1.85-2.27-4.36-3.41-7.52-3.41 -3.35 0-6.05 1.17-8.09 3.5C235.17 26.47 234.15 29.39 234.15 32.91z"/>
|
||||
<path d="M283.09 52.28c-1.36 0.75-3.15 1.12-5.38 1.12 -6.3 0-9.46-3.52-9.46-10.55v-21.3h-6.19v-4.92h6.19V7.84l5.77-1.86v10.65h9.07v4.92h-9.07v20.28c0 2.41 0.41 4.14 1.23 5.17s2.18 1.55 4.08 1.55c1.45 0 2.71-0.4 3.76-1.2V52.28z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,124 @@
|
||||
/// <reference path="../src/harness/external/node.d.ts" />
|
||||
/// <reference path="../built/local/typescript.d.ts" />
|
||||
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import * as typescript from "typescript";
|
||||
declare var ts: typeof typescript;
|
||||
|
||||
var tsSourceDir = "../src";
|
||||
var tsBuildDir = "../built/local";
|
||||
var testOutputDir = "../built/benchmark";
|
||||
var sourceFiles = [
|
||||
"compiler/types.ts",
|
||||
"compiler/core.ts",
|
||||
"compiler/sys.ts",
|
||||
"compiler/diagnosticInformationMap.generated.ts",
|
||||
"compiler/scanner.ts",
|
||||
"compiler/binder.ts",
|
||||
"compiler/utilities.ts",
|
||||
"compiler/parser.ts",
|
||||
"compiler/checker.ts",
|
||||
"compiler/declarationEmitter.ts",
|
||||
"compiler/emitter.ts",
|
||||
"compiler/program.ts",
|
||||
"compiler/commandLineParser.ts",
|
||||
"compiler/tsc.ts"];
|
||||
|
||||
// .ts sources for the compiler, used as a test input
|
||||
var rawCompilerSources = "";
|
||||
sourceFiles.forEach(f=> {
|
||||
rawCompilerSources += "\r\n" + fs.readFileSync(path.join(tsSourceDir, f)).toString();
|
||||
});
|
||||
var compilerSoruces = `var compilerSources = ${JSON.stringify(rawCompilerSources) };`;
|
||||
|
||||
// .js code for the compiler, what we are actuallty testing
|
||||
var rawCompilerJavaScript = fs.readFileSync(path.join(tsBuildDir, "tsc.js")).toString();
|
||||
rawCompilerJavaScript = rawCompilerJavaScript.replace("ts.executeCommandLine(ts.sys.args);", "");
|
||||
|
||||
// lib.d.ts sources
|
||||
var rawLibSources = fs.readFileSync(path.join(tsBuildDir, "lib.d.ts")).toString();
|
||||
var libSoruces = `var libSources = ${JSON.stringify(rawLibSources) };`;
|
||||
|
||||
// write test output
|
||||
if (!fs.existsSync(testOutputDir)) {
|
||||
fs.mkdirSync(testOutputDir);
|
||||
}
|
||||
|
||||
// 1. compiler ts sources, used to test
|
||||
fs.writeFileSync(
|
||||
path.join(testOutputDir, "compilerSources.js"),
|
||||
`${ compilerSoruces } \r\n ${ libSoruces }`);
|
||||
|
||||
// 2. the compiler js sources + a call the compiler
|
||||
fs.writeFileSync(
|
||||
path.join(testOutputDir, "benchmarktsc.js"),
|
||||
`${ rawCompilerJavaScript }\r\n${ compile.toString() }\r\ncompile(compilerSources, libSources);`);
|
||||
|
||||
// 3. test html file to drive the test
|
||||
fs.writeFileSync(
|
||||
path.join(testOutputDir, "benchmarktsc.html"),
|
||||
`<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
||||
<title>Typescript 1.1 Compiler</title>
|
||||
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
|
||||
</head>
|
||||
<body>
|
||||
<div><span>Status: </span><span id="status">Running</span></div>
|
||||
<div id="main"><span>End-to-End Time: </span><span id="totalTime">N/A</span></div>
|
||||
<script>
|
||||
var startTime = performance.now();
|
||||
</script>
|
||||
<script src="compilerSources.js"></script>
|
||||
<script src="benchmarktsc.js"></script>
|
||||
<script>
|
||||
var endTime = performance.now();
|
||||
document.getElementById("totalTime").innerHTML = parseInt(endTime - startTime, 10);
|
||||
document.getElementById("status").innerHTML = "DONE";
|
||||
</script>
|
||||
</body>
|
||||
</html>`);
|
||||
|
||||
function compile(compilerSources, librarySources) {
|
||||
var program = ts.createProgram(
|
||||
["lib.d.ts", "compiler.ts"],
|
||||
{
|
||||
noResolve: true,
|
||||
out: "compiler.js",
|
||||
removeComments: true,
|
||||
target: ts.ScriptTarget.ES3
|
||||
}, {
|
||||
getDefaultLibFileName: () => "lib.d.ts",
|
||||
getSourceFile: (filename, languageVersion) => {
|
||||
var source: string;
|
||||
if (filename === "lib.d.ts") source = librarySources;
|
||||
else if (filename === "compiler.ts") source = compilerSources;
|
||||
else console.error("Unexpected read file request: " + filename);
|
||||
|
||||
return ts.createSourceFile(filename, source, languageVersion);
|
||||
},
|
||||
writeFile: (filename, data, writeByteOrderMark) => {
|
||||
if (filename !== "compiler.js")
|
||||
console.error("Unexpected write file request: " + filename);
|
||||
// console.log(data);
|
||||
},
|
||||
getCurrentDirectory: () => "",
|
||||
getCanonicalFileName: (filename) => filename,
|
||||
useCaseSensitiveFileNames: () => false,
|
||||
getNewLine: () => "\r\n"
|
||||
});
|
||||
|
||||
var emitOutput = program.emit();
|
||||
|
||||
var errors = program.getSyntacticDiagnostics()
|
||||
.concat(program.getSemanticDiagnostics())
|
||||
.concat(program.getGlobalDiagnostics())
|
||||
.concat(emitOutput.diagnostics);
|
||||
|
||||
if (errors.length) {
|
||||
console.error("Unexpected errors.");
|
||||
errors.forEach(e=> console.log(`${e.code}: ${e.messageText}`))
|
||||
}
|
||||
}
|
||||
+10
-5
@@ -239,11 +239,7 @@ module ts {
|
||||
if (symbolKind & SymbolFlags.IsContainer) {
|
||||
container = node;
|
||||
|
||||
if (lastContainer) {
|
||||
lastContainer.nextContainer = container;
|
||||
}
|
||||
|
||||
lastContainer = container;
|
||||
addToContainerChain(container);
|
||||
}
|
||||
|
||||
if (isBlockScopeContainer) {
|
||||
@@ -262,6 +258,14 @@ module ts {
|
||||
blockScopeContainer = savedBlockScopeContainer;
|
||||
}
|
||||
|
||||
function addToContainerChain(node: Node) {
|
||||
if (lastContainer) {
|
||||
lastContainer.nextContainer = node;
|
||||
}
|
||||
|
||||
lastContainer = node;
|
||||
}
|
||||
|
||||
function bindDeclaration(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags, isBlockScopeContainer: boolean) {
|
||||
switch (container.kind) {
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
@@ -403,6 +407,7 @@ module ts {
|
||||
default:
|
||||
if (!blockScopeContainer.locals) {
|
||||
blockScopeContainer.locals = {};
|
||||
addToContainerChain(blockScopeContainer);
|
||||
}
|
||||
declareSymbol(blockScopeContainer.locals, undefined, node, symbolKind, symbolExcludes);
|
||||
}
|
||||
|
||||
+231
-188
@@ -88,12 +88,11 @@ module ts {
|
||||
let undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined");
|
||||
let nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null");
|
||||
let unknownType = createIntrinsicType(TypeFlags.Any, "unknown");
|
||||
let resolvingType = createIntrinsicType(TypeFlags.Any, "__resolving__");
|
||||
|
||||
let emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
let anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
let noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
|
||||
|
||||
let anySignature = createSignature(undefined, undefined, emptyArray, anyType, 0, false, false);
|
||||
let unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, false, false);
|
||||
|
||||
@@ -118,7 +117,7 @@ module ts {
|
||||
let getGlobalParameterDecoratorType: () => ObjectType;
|
||||
let getGlobalPropertyDecoratorType: () => ObjectType;
|
||||
let getGlobalMethodDecoratorType: () => ObjectType;
|
||||
|
||||
|
||||
let tupleTypes: Map<TupleType> = {};
|
||||
let unionTypes: Map<UnionType> = {};
|
||||
let stringLiteralTypes: Map<StringLiteralType> = {};
|
||||
@@ -126,6 +125,9 @@ module ts {
|
||||
let emitDecorate = false;
|
||||
let emitParam = false;
|
||||
|
||||
let resolutionTargets: Object[] = [];
|
||||
let resolutionResults: boolean[] = [];
|
||||
|
||||
let mergedSymbols: Symbol[] = [];
|
||||
let symbolLinks: SymbolLinks[] = [];
|
||||
let nodeLinks: NodeLinks[] = [];
|
||||
@@ -350,9 +352,9 @@ module ts {
|
||||
}
|
||||
else if (location.kind === SyntaxKind.SourceFile ||
|
||||
(location.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>location).name.kind === SyntaxKind.StringLiteral)) {
|
||||
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & SymbolFlags.ModuleMember);
|
||||
result = getSymbolOfNode(location).exports["default"];
|
||||
let localSymbol = getLocalSymbolForExportDefault(result);
|
||||
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
|
||||
if (result && localSymbol && (result.flags & meaning) && localSymbol.name === name) {
|
||||
break loop;
|
||||
}
|
||||
result = undefined;
|
||||
@@ -582,7 +584,7 @@ module ts {
|
||||
if (moduleSymbol) {
|
||||
let exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]);
|
||||
if (!exportDefaultSymbol) {
|
||||
error(node.name, Diagnostics.External_module_0_has_no_default_export, symbolToString(moduleSymbol));
|
||||
error(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
|
||||
}
|
||||
return exportDefaultSymbol;
|
||||
}
|
||||
@@ -801,7 +803,9 @@ module ts {
|
||||
|
||||
let symbol: Symbol;
|
||||
if (name.kind === SyntaxKind.Identifier) {
|
||||
symbol = resolveName(name, (<Identifier>name).text, meaning, Diagnostics.Cannot_find_name_0, <Identifier>name);
|
||||
let message = meaning === SymbolFlags.Namespace ? Diagnostics.Cannot_find_namespace_0 : Diagnostics.Cannot_find_name_0;
|
||||
|
||||
symbol = resolveName(name, (<Identifier>name).text, meaning, message, <Identifier>name);
|
||||
if (!symbol) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -870,10 +874,10 @@ module ts {
|
||||
if (sourceFile.symbol) {
|
||||
return sourceFile.symbol;
|
||||
}
|
||||
error(moduleReferenceLiteral, Diagnostics.File_0_is_not_an_external_module, sourceFile.fileName);
|
||||
error(moduleReferenceLiteral, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
|
||||
return;
|
||||
}
|
||||
error(moduleReferenceLiteral, Diagnostics.Cannot_find_external_module_0, moduleName);
|
||||
error(moduleReferenceLiteral, Diagnostics.Cannot_find_module_0, moduleName);
|
||||
}
|
||||
|
||||
// An external module with an 'export =' declaration resolves to the target of the 'export =' declaration,
|
||||
@@ -888,7 +892,7 @@ module ts {
|
||||
function resolveESModuleSymbol(moduleSymbol: Symbol, moduleReferenceExpression: Expression): Symbol {
|
||||
let symbol = resolveExternalModuleSymbol(moduleSymbol);
|
||||
if (symbol && !(symbol.flags & (SymbolFlags.Module | SymbolFlags.Variable))) {
|
||||
error(moduleReferenceExpression, Diagnostics.External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol));
|
||||
error(moduleReferenceExpression, Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol));
|
||||
symbol = undefined;
|
||||
}
|
||||
return symbol;
|
||||
@@ -1980,7 +1984,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function collectLinkedAliases(node: Identifier): Node[]{
|
||||
function collectLinkedAliases(node: Identifier): Node[] {
|
||||
var exportSymbol: Symbol;
|
||||
if (node.parent && node.parent.kind === SyntaxKind.ExportAssignment) {
|
||||
exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, Diagnostics.Cannot_find_name_0, node);
|
||||
@@ -2014,6 +2018,38 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
// Push an entry on the type resolution stack. If an entry with the given target is not already on the stack,
|
||||
// a new entry with that target and an associated result value of true is pushed on the stack, and the value
|
||||
// true is returned. Otherwise, a circularity has occurred and the result values of the existing entry and
|
||||
// all entries pushed after it are changed to false, and the value false is returned. The target object provides
|
||||
// a unique identity for a particular type resolution result: Symbol instances are used to track resolution of
|
||||
// SymbolLinks.type, SymbolLinks instances are used to track resolution of SymbolLinks.declaredType, and
|
||||
// Signature instances are used to track resolution of Signature.resolvedReturnType.
|
||||
function pushTypeResolution(target: Object): boolean {
|
||||
let i = 0;
|
||||
let count = resolutionTargets.length;
|
||||
while (i < count && resolutionTargets[i] !== target) {
|
||||
i++;
|
||||
}
|
||||
if (i < count) {
|
||||
do {
|
||||
resolutionResults[i++] = false;
|
||||
}
|
||||
while (i < count);
|
||||
return false;
|
||||
}
|
||||
resolutionTargets.push(target);
|
||||
resolutionResults.push(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Pop an entry from the type resolution stack and return its associated result value. The result value will
|
||||
// be true if no circularities were detected, or false if a circularity was found.
|
||||
function popTypeResolution(): boolean {
|
||||
resolutionTargets.pop();
|
||||
return resolutionResults.pop();
|
||||
}
|
||||
|
||||
function getRootDeclaration(node: Node): Node {
|
||||
while (node.kind === SyntaxKind.BindingElement) {
|
||||
node = node.parent.parent;
|
||||
@@ -2271,20 +2307,27 @@ module ts {
|
||||
return links.type = checkExpression((<ExportAssignment>declaration).expression);
|
||||
}
|
||||
// Handle variable, parameter or property
|
||||
links.type = resolvingType;
|
||||
if (!pushTypeResolution(symbol)) {
|
||||
return unknownType;
|
||||
}
|
||||
let type = getWidenedTypeForVariableLikeDeclaration(<VariableLikeDeclaration>declaration, /*reportErrors*/ true);
|
||||
if (links.type === resolvingType) {
|
||||
links.type = type;
|
||||
}
|
||||
}
|
||||
else if (links.type === resolvingType) {
|
||||
links.type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
let diagnostic = (<VariableLikeDeclaration>symbol.valueDeclaration).type ?
|
||||
Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation :
|
||||
Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer;
|
||||
error(symbol.valueDeclaration, diagnostic, symbolToString(symbol));
|
||||
if (!popTypeResolution()) {
|
||||
if ((<VariableLikeDeclaration>symbol.valueDeclaration).type) {
|
||||
// Variable has type annotation that circularly references the variable itself
|
||||
type = unknownType;
|
||||
error(symbol.valueDeclaration, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,
|
||||
symbolToString(symbol));
|
||||
}
|
||||
else {
|
||||
// Variable has initializer that circularly references the variable itself
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
error(symbol.valueDeclaration, Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer,
|
||||
symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
@@ -2308,19 +2351,13 @@ module ts {
|
||||
|
||||
function getTypeOfAccessors(symbol: Symbol): Type {
|
||||
let links = getSymbolLinks(symbol);
|
||||
checkAndStoreTypeOfAccessors(symbol, links);
|
||||
return links.type;
|
||||
}
|
||||
|
||||
function checkAndStoreTypeOfAccessors(symbol: Symbol, links?: SymbolLinks) {
|
||||
links = links || getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = resolvingType;
|
||||
if (!pushTypeResolution(symbol)) {
|
||||
return unknownType;
|
||||
}
|
||||
let getter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.GetAccessor);
|
||||
let setter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.SetAccessor);
|
||||
|
||||
let type: Type;
|
||||
|
||||
// First try to see if the user specified a return type on the get-accessor.
|
||||
let getterReturnType = getAnnotatedAccessorType(getter);
|
||||
if (getterReturnType) {
|
||||
@@ -2342,23 +2379,20 @@ module ts {
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
error(setter, Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbolToString(symbol));
|
||||
}
|
||||
|
||||
type = anyType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (links.type === resolvingType) {
|
||||
links.type = type;
|
||||
}
|
||||
}
|
||||
else if (links.type === resolvingType) {
|
||||
links.type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
let getter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.GetAccessor);
|
||||
error(getter, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
|
||||
if (!popTypeResolution()) {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
let getter = <AccessorDeclaration>getDeclarationOfKind(symbol, SyntaxKind.GetAccessor);
|
||||
error(getter, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
|
||||
function getTypeOfFuncClassEnumModule(symbol: Symbol): Type {
|
||||
@@ -2451,7 +2485,7 @@ module ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function getBaseTypes(type: InterfaceType): ObjectType[]{
|
||||
function getBaseTypes(type: InterfaceType): ObjectType[] {
|
||||
let typeWithBaseTypes = <InterfaceTypeWithBaseTypes>type;
|
||||
if (!typeWithBaseTypes.baseTypes) {
|
||||
if (type.symbol.flags & SymbolFlags.Class) {
|
||||
@@ -2473,7 +2507,7 @@ module ts {
|
||||
let declaration = <ClassDeclaration>getDeclarationOfKind(type.symbol, SyntaxKind.ClassDeclaration);
|
||||
let baseTypeNode = getClassExtendsHeritageClauseElement(declaration);
|
||||
if (baseTypeNode) {
|
||||
let baseType = getTypeFromHeritageClauseElement(baseTypeNode);
|
||||
let baseType = getTypeFromTypeNode(baseTypeNode);
|
||||
if (baseType !== unknownType) {
|
||||
if (getTargetType(baseType).flags & TypeFlags.Class) {
|
||||
if (type !== baseType && !hasBaseType(<InterfaceType>baseType, type)) {
|
||||
@@ -2495,7 +2529,7 @@ module ts {
|
||||
for (let declaration of type.symbol.declarations) {
|
||||
if (declaration.kind === SyntaxKind.InterfaceDeclaration && getInterfaceBaseTypeNodes(<InterfaceDeclaration>declaration)) {
|
||||
for (let node of getInterfaceBaseTypeNodes(<InterfaceDeclaration>declaration)) {
|
||||
let baseType = getTypeFromHeritageClauseElement(node);
|
||||
let baseType = getTypeFromTypeNode(node);
|
||||
|
||||
if (baseType !== unknownType) {
|
||||
if (getTargetType(baseType).flags & (TypeFlags.Class | TypeFlags.Interface)) {
|
||||
@@ -2515,10 +2549,11 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getDeclaredTypeOfClass(symbol: Symbol): InterfaceType {
|
||||
function getDeclaredTypeOfClassOrInterface(symbol: Symbol): InterfaceType {
|
||||
let links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
let type = links.declaredType = <InterfaceType>createObjectType(TypeFlags.Class, symbol);
|
||||
let kind = symbol.flags & SymbolFlags.Class ? TypeFlags.Class : TypeFlags.Interface;
|
||||
let type = links.declaredType = <InterfaceType>createObjectType(kind, symbol);
|
||||
let typeParameters = getTypeParametersOfClassOrInterface(symbol);
|
||||
if (typeParameters) {
|
||||
type.flags |= TypeFlags.Reference;
|
||||
@@ -2528,35 +2563,6 @@ module ts {
|
||||
(<GenericType>type).target = <GenericType>type;
|
||||
(<GenericType>type).typeArguments = type.typeParameters;
|
||||
}
|
||||
|
||||
type.declaredProperties = getNamedMembers(symbol.members);
|
||||
type.declaredCallSignatures = emptyArray;
|
||||
type.declaredConstructSignatures = emptyArray;
|
||||
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number);
|
||||
}
|
||||
return <InterfaceType>links.declaredType;
|
||||
}
|
||||
|
||||
function getDeclaredTypeOfInterface(symbol: Symbol): InterfaceType {
|
||||
let links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
let type = links.declaredType = <InterfaceType>createObjectType(TypeFlags.Interface, symbol);
|
||||
let typeParameters = getTypeParametersOfClassOrInterface(symbol);
|
||||
if (typeParameters) {
|
||||
type.flags |= TypeFlags.Reference;
|
||||
type.typeParameters = typeParameters;
|
||||
(<GenericType>type).instantiations = {};
|
||||
(<GenericType>type).instantiations[getTypeListId(type.typeParameters)] = <GenericType>type;
|
||||
(<GenericType>type).target = <GenericType>type;
|
||||
(<GenericType>type).typeArguments = type.typeParameters;
|
||||
}
|
||||
|
||||
type.declaredProperties = getNamedMembers(symbol.members);
|
||||
type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]);
|
||||
type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]);
|
||||
type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String);
|
||||
type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number);
|
||||
}
|
||||
return <InterfaceType>links.declaredType;
|
||||
}
|
||||
@@ -2564,17 +2570,18 @@ module ts {
|
||||
function getDeclaredTypeOfTypeAlias(symbol: Symbol): Type {
|
||||
let links = getSymbolLinks(symbol);
|
||||
if (!links.declaredType) {
|
||||
links.declaredType = resolvingType;
|
||||
// Note that we use the links object as the target here because the symbol object is used as the unique
|
||||
// identity for resolution of the 'type' property in SymbolLinks.
|
||||
if (!pushTypeResolution(links)) {
|
||||
return unknownType;
|
||||
}
|
||||
let declaration = <TypeAliasDeclaration>getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration);
|
||||
let type = getTypeFromTypeNode(declaration.type);
|
||||
if (links.declaredType === resolvingType) {
|
||||
links.declaredType = type;
|
||||
if (!popTypeResolution()) {
|
||||
type = unknownType;
|
||||
error(declaration.name, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
else if (links.declaredType === resolvingType) {
|
||||
links.declaredType = unknownType;
|
||||
let declaration = <TypeAliasDeclaration>getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration);
|
||||
error(declaration.name, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
links.declaredType = type;
|
||||
}
|
||||
return links.declaredType;
|
||||
}
|
||||
@@ -2612,11 +2619,8 @@ module ts {
|
||||
|
||||
function getDeclaredTypeOfSymbol(symbol: Symbol): Type {
|
||||
Debug.assert((symbol.flags & SymbolFlags.Instantiated) === 0);
|
||||
if (symbol.flags & SymbolFlags.Class) {
|
||||
return getDeclaredTypeOfClass(symbol);
|
||||
}
|
||||
if (symbol.flags & SymbolFlags.Interface) {
|
||||
return getDeclaredTypeOfInterface(symbol);
|
||||
if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
return getDeclaredTypeOfClassOrInterface(symbol);
|
||||
}
|
||||
if (symbol.flags & SymbolFlags.TypeAlias) {
|
||||
return getDeclaredTypeOfTypeAlias(symbol);
|
||||
@@ -2665,15 +2669,28 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function resolveDeclaredMembers(type: InterfaceType): InterfaceTypeWithDeclaredMembers {
|
||||
if (!(<InterfaceTypeWithDeclaredMembers>type).declaredProperties) {
|
||||
var symbol = type.symbol;
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredProperties = getNamedMembers(symbol.members);
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]);
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]);
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredStringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String);
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredNumberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number);
|
||||
}
|
||||
return <InterfaceTypeWithDeclaredMembers>type;
|
||||
}
|
||||
|
||||
function resolveClassOrInterfaceMembers(type: InterfaceType): void {
|
||||
let members = type.symbol.members;
|
||||
let callSignatures = type.declaredCallSignatures;
|
||||
let constructSignatures = type.declaredConstructSignatures;
|
||||
let stringIndexType = type.declaredStringIndexType;
|
||||
let numberIndexType = type.declaredNumberIndexType;
|
||||
let baseTypes = getBaseTypes(type);
|
||||
let target = resolveDeclaredMembers(type);
|
||||
let members = target.symbol.members;
|
||||
let callSignatures = target.declaredCallSignatures;
|
||||
let constructSignatures = target.declaredConstructSignatures;
|
||||
let stringIndexType = target.declaredStringIndexType;
|
||||
let numberIndexType = target.declaredNumberIndexType;
|
||||
let baseTypes = getBaseTypes(target);
|
||||
if (baseTypes.length) {
|
||||
members = createSymbolTable(type.declaredProperties);
|
||||
members = createSymbolTable(target.declaredProperties);
|
||||
for (let baseType of baseTypes) {
|
||||
addInheritedMembers(members, getPropertiesOfObjectType(baseType));
|
||||
callSignatures = concatenate(callSignatures, getSignaturesOfType(baseType, SignatureKind.Call));
|
||||
@@ -2686,7 +2703,7 @@ module ts {
|
||||
}
|
||||
|
||||
function resolveTypeReferenceMembers(type: TypeReference): void {
|
||||
let target = type.target;
|
||||
let target = resolveDeclaredMembers(type.target);
|
||||
let mapper = createTypeMapper(target.typeParameters, type.typeArguments);
|
||||
let members = createInstantiatedSymbolTable(target.declaredProperties, mapper);
|
||||
let callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature);
|
||||
@@ -2842,7 +2859,7 @@ module ts {
|
||||
callSignatures = getSignaturesOfSymbol(symbol);
|
||||
}
|
||||
if (symbol.flags & SymbolFlags.Class) {
|
||||
let classType = getDeclaredTypeOfClass(symbol);
|
||||
let classType = getDeclaredTypeOfClassOrInterface(symbol);
|
||||
constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]);
|
||||
if (!constructSignatures.length) {
|
||||
constructSignatures = getDefaultConstructSignatures(classType);
|
||||
@@ -2955,7 +2972,7 @@ module ts {
|
||||
let type = getApparentType(current);
|
||||
if (type !== unknownType) {
|
||||
let prop = getPropertyOfType(type, name);
|
||||
if (!prop) {
|
||||
if (!prop || getDeclarationFlagsFromSymbol(prop) & (NodeFlags.Private | NodeFlags.Protected)) {
|
||||
return undefined;
|
||||
}
|
||||
if (!props) {
|
||||
@@ -3083,7 +3100,7 @@ module ts {
|
||||
function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature {
|
||||
let links = getNodeLinks(declaration);
|
||||
if (!links.resolvedSignature) {
|
||||
let classType = declaration.kind === SyntaxKind.Constructor ? getDeclaredTypeOfClass((<ClassDeclaration>declaration.parent).symbol) : undefined;
|
||||
let classType = declaration.kind === SyntaxKind.Constructor ? getDeclaredTypeOfClassOrInterface((<ClassDeclaration>declaration.parent).symbol) : undefined;
|
||||
let typeParameters = classType ? classType.typeParameters :
|
||||
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined;
|
||||
let parameters: Symbol[] = [];
|
||||
@@ -3168,7 +3185,9 @@ module ts {
|
||||
|
||||
function getReturnTypeOfSignature(signature: Signature): Type {
|
||||
if (!signature.resolvedReturnType) {
|
||||
signature.resolvedReturnType = resolvingType;
|
||||
if (!pushTypeResolution(signature)) {
|
||||
return unknownType;
|
||||
}
|
||||
let type: Type;
|
||||
if (signature.target) {
|
||||
type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper);
|
||||
@@ -3179,28 +3198,26 @@ module ts {
|
||||
else {
|
||||
type = getReturnTypeFromBody(<FunctionLikeDeclaration>signature.declaration);
|
||||
}
|
||||
if (signature.resolvedReturnType === resolvingType) {
|
||||
signature.resolvedReturnType = type;
|
||||
}
|
||||
}
|
||||
else if (signature.resolvedReturnType === resolvingType) {
|
||||
signature.resolvedReturnType = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
let declaration = <Declaration>signature.declaration;
|
||||
if (declaration.name) {
|
||||
error(declaration.name, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, declarationNameToString(declaration.name));
|
||||
}
|
||||
else {
|
||||
error(declaration, Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
|
||||
if (!popTypeResolution()) {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
let declaration = <Declaration>signature.declaration;
|
||||
if (declaration.name) {
|
||||
error(declaration.name, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, declarationNameToString(declaration.name));
|
||||
}
|
||||
else {
|
||||
error(declaration, Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions);
|
||||
}
|
||||
}
|
||||
}
|
||||
signature.resolvedReturnType = type;
|
||||
}
|
||||
return signature.resolvedReturnType;
|
||||
}
|
||||
|
||||
function getRestTypeOfSignature(signature: Signature): Type {
|
||||
if (signature.hasRestParameter) {
|
||||
let type = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
|
||||
let type = getTypeOfSymbol(lastOrUndefined(signature.parameters));
|
||||
if (type.flags & TypeFlags.Reference && (<TypeReference>type).target === globalArrayType) {
|
||||
return (<TypeReference>type).typeArguments[0];
|
||||
}
|
||||
@@ -3328,7 +3345,7 @@ module ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode: TypeReferenceNode | HeritageClauseElement, typeParameterSymbol: Symbol): boolean {
|
||||
function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode: TypeReferenceNode | ExpressionWithTypeArguments, typeParameterSymbol: Symbol): boolean {
|
||||
let links = getNodeLinks(typeReferenceNode);
|
||||
if (links.isIllegalTypeReferenceInConstraint !== undefined) {
|
||||
return links.isIllegalTypeReferenceInConstraint;
|
||||
@@ -3377,25 +3394,17 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getTypeFromTypeReference(node: TypeReferenceNode): Type {
|
||||
return getTypeFromTypeReferenceOrHeritageClauseElement(node);
|
||||
}
|
||||
|
||||
function getTypeFromHeritageClauseElement(node: HeritageClauseElement): Type {
|
||||
return getTypeFromTypeReferenceOrHeritageClauseElement(node);
|
||||
}
|
||||
|
||||
function getTypeFromTypeReferenceOrHeritageClauseElement(node: TypeReferenceNode | HeritageClauseElement): Type {
|
||||
function getTypeFromTypeReferenceOrExpressionWithTypeArguments(node: TypeReferenceNode | ExpressionWithTypeArguments): Type {
|
||||
let links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
let type: Type;
|
||||
|
||||
// We don't currently support heritage clauses with complex expressions in them.
|
||||
// For these cases, we just set the type to be the unknownType.
|
||||
if (node.kind !== SyntaxKind.HeritageClauseElement || isSupportedHeritageClauseElement(<HeritageClauseElement>node)) {
|
||||
if (node.kind !== SyntaxKind.ExpressionWithTypeArguments || isSupportedExpressionWithTypeArguments(<ExpressionWithTypeArguments>node)) {
|
||||
let typeNameOrExpression = node.kind === SyntaxKind.TypeReference
|
||||
? (<TypeReferenceNode>node).typeName
|
||||
: (<HeritageClauseElement>node).expression;
|
||||
: (<ExpressionWithTypeArguments>node).expression;
|
||||
|
||||
let symbol = resolveEntityName(typeNameOrExpression, SymbolFlags.Type);
|
||||
if (symbol) {
|
||||
@@ -3685,9 +3694,9 @@ module ts {
|
||||
case SyntaxKind.StringLiteral:
|
||||
return getTypeFromStringLiteral(<StringLiteral>node);
|
||||
case SyntaxKind.TypeReference:
|
||||
return getTypeFromTypeReference(<TypeReferenceNode>node);
|
||||
case SyntaxKind.HeritageClauseElement:
|
||||
return getTypeFromHeritageClauseElement(<HeritageClauseElement>node);
|
||||
return getTypeFromTypeReferenceOrExpressionWithTypeArguments(<TypeReferenceNode>node);
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return getTypeFromTypeReferenceOrExpressionWithTypeArguments(<ExpressionWithTypeArguments>node);
|
||||
case SyntaxKind.TypeQuery:
|
||||
return getTypeFromTypeQueryNode(<TypeQueryNode>node);
|
||||
case SyntaxKind.ArrayType:
|
||||
@@ -5377,17 +5386,35 @@ module ts {
|
||||
}
|
||||
// Target type is type of prototype property
|
||||
let prototypeProperty = getPropertyOfType(rightType, "prototype");
|
||||
if (!prototypeProperty) {
|
||||
return type;
|
||||
if (prototypeProperty) {
|
||||
let targetType = getTypeOfSymbol(prototypeProperty);
|
||||
if (targetType !== anyType) {
|
||||
// Narrow to the target type if it's a subtype of the current type
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
}
|
||||
// If the current type is a union type, remove all constituents that aren't subtypes of the target.
|
||||
if (type.flags & TypeFlags.Union) {
|
||||
return getUnionType(filter((<UnionType>type).types, t => isTypeSubtypeOf(t, targetType)));
|
||||
}
|
||||
}
|
||||
}
|
||||
let targetType = getTypeOfSymbol(prototypeProperty);
|
||||
// Narrow to target type if it is a subtype of current type
|
||||
if (isTypeSubtypeOf(targetType, type)) {
|
||||
return targetType;
|
||||
// Target type is type of construct signature
|
||||
let constructSignatures: Signature[];
|
||||
if (rightType.flags & TypeFlags.Interface) {
|
||||
constructSignatures = resolveDeclaredMembers(<InterfaceType>rightType).declaredConstructSignatures;
|
||||
}
|
||||
// If current type is a union type, remove all constituents that aren't subtypes of target type
|
||||
if (type.flags & TypeFlags.Union) {
|
||||
return getUnionType(filter((<UnionType>type).types, t => isTypeSubtypeOf(t, targetType)));
|
||||
else if (rightType.flags & TypeFlags.Anonymous) {
|
||||
constructSignatures = getSignaturesOfType(rightType, SignatureKind.Construct);
|
||||
}
|
||||
|
||||
if (constructSignatures && constructSignatures.length !== 0) {
|
||||
let instanceType = getUnionType(map(constructSignatures, signature => getReturnTypeOfSignature(getErasedSignature(signature))));
|
||||
// Pickup type from union types
|
||||
if (type.flags & TypeFlags.Union) {
|
||||
return getUnionType(filter((<UnionType>type).types, t => isTypeSubtypeOf(t, instanceType)));
|
||||
}
|
||||
return instanceType;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -5526,7 +5553,7 @@ module ts {
|
||||
|
||||
switch (container.kind) {
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
error(node, Diagnostics.this_cannot_be_referenced_in_a_module_body);
|
||||
error(node, Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
|
||||
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
|
||||
break;
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
@@ -5692,7 +5719,7 @@ module ts {
|
||||
// If last parameter is contextually rest parameter get its type
|
||||
if (indexOfParameter === (func.parameters.length - 1) &&
|
||||
funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) {
|
||||
return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]);
|
||||
return getTypeOfSymbol(lastOrUndefined(contextualSignature.parameters));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7241,9 +7268,9 @@ module ts {
|
||||
links.type = instantiateType(getTypeAtPosition(context, i), mapper);
|
||||
}
|
||||
if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) {
|
||||
let parameter = signature.parameters[signature.parameters.length - 1];
|
||||
let parameter = lastOrUndefined(signature.parameters);
|
||||
let links = getSymbolLinks(parameter);
|
||||
links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper);
|
||||
links.type = instantiateType(getTypeOfSymbol(lastOrUndefined(context.parameters)), mapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7368,10 +7395,9 @@ module ts {
|
||||
if (isContextSensitive(node)) {
|
||||
assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper);
|
||||
}
|
||||
if (!node.type) {
|
||||
signature.resolvedReturnType = resolvingType;
|
||||
if (!node.type && !signature.resolvedReturnType) {
|
||||
let returnType = getReturnTypeFromBody(node, contextualMapper);
|
||||
if (signature.resolvedReturnType === resolvingType) {
|
||||
if (!signature.resolvedReturnType) {
|
||||
signature.resolvedReturnType = returnType;
|
||||
}
|
||||
}
|
||||
@@ -8385,8 +8411,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkAndStoreTypeOfAccessors(getSymbolOfNode(node));
|
||||
getTypeOfAccessors(getSymbolOfNode(node));
|
||||
}
|
||||
|
||||
checkFunctionLikeDeclaration(node);
|
||||
@@ -8398,20 +8423,20 @@ module ts {
|
||||
|
||||
function checkTypeReferenceNode(node: TypeReferenceNode) {
|
||||
checkGrammarTypeReferenceInStrictMode(node.typeName);
|
||||
return checkTypeReferenceOrHeritageClauseElement(node);
|
||||
return checkTypeReferenceOrExpressionWithTypeArguments(node);
|
||||
}
|
||||
|
||||
function checkHeritageClauseElement(node: HeritageClauseElement) {
|
||||
checkGrammarHeritageClauseElementInStrictMode(<PropertyAccessExpression>node.expression);
|
||||
function checkExpressionWithTypeArguments(node: ExpressionWithTypeArguments) {
|
||||
checkGrammarExpressionWithTypeArgumentsInStrictMode(<PropertyAccessExpression>node.expression);
|
||||
|
||||
return checkTypeReferenceOrHeritageClauseElement(node);
|
||||
return checkTypeReferenceOrExpressionWithTypeArguments(node);
|
||||
}
|
||||
|
||||
function checkTypeReferenceOrHeritageClauseElement(node: TypeReferenceNode | HeritageClauseElement) {
|
||||
function checkTypeReferenceOrExpressionWithTypeArguments(node: TypeReferenceNode | ExpressionWithTypeArguments) {
|
||||
// Grammar checking
|
||||
checkGrammarTypeArguments(node, node.typeArguments);
|
||||
|
||||
let type = getTypeFromTypeReferenceOrHeritageClauseElement(node);
|
||||
let type = getTypeFromTypeReferenceOrExpressionWithTypeArguments(node);
|
||||
if (type !== unknownType && node.typeArguments) {
|
||||
// Do type argument local checks only if referenced type is successfully resolved
|
||||
let len = node.typeArguments.length;
|
||||
@@ -9097,7 +9122,7 @@ module ts {
|
||||
let parent = getDeclarationContainer(node);
|
||||
if (parent.kind === SyntaxKind.SourceFile && isExternalModule(<SourceFile>parent)) {
|
||||
// If the declaration happens to be in external module, report error that require and exports are reserved keywords
|
||||
error(name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module,
|
||||
error(name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module,
|
||||
declarationNameToString(name), declarationNameToString(name));
|
||||
}
|
||||
}
|
||||
@@ -9366,7 +9391,7 @@ module ts {
|
||||
}
|
||||
|
||||
if (node.condition) checkExpression(node.condition);
|
||||
if (node.iterator) checkExpression(node.iterator);
|
||||
if (node.incrementor) checkExpression(node.incrementor);
|
||||
checkSourceElement(node.statement);
|
||||
}
|
||||
|
||||
@@ -9977,12 +10002,12 @@ module ts {
|
||||
let staticType = <ObjectType>getTypeOfSymbol(symbol);
|
||||
let baseTypeNode = getClassExtendsHeritageClauseElement(node);
|
||||
if (baseTypeNode) {
|
||||
if (!isSupportedHeritageClauseElement(baseTypeNode)) {
|
||||
if (!isSupportedExpressionWithTypeArguments(baseTypeNode)) {
|
||||
error(baseTypeNode.expression, Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses);
|
||||
}
|
||||
|
||||
emitExtends = emitExtends || !isInAmbientContext(node);
|
||||
checkHeritageClauseElement(baseTypeNode);
|
||||
checkExpressionWithTypeArguments(baseTypeNode);
|
||||
}
|
||||
let baseTypes = getBaseTypes(type);
|
||||
if (baseTypes.length) {
|
||||
@@ -10009,13 +10034,13 @@ module ts {
|
||||
let implementedTypeNodes = getClassImplementsHeritageClauseElements(node);
|
||||
if (implementedTypeNodes) {
|
||||
forEach(implementedTypeNodes, typeRefNode => {
|
||||
if (!isSupportedHeritageClauseElement(typeRefNode)) {
|
||||
if (!isSupportedExpressionWithTypeArguments(typeRefNode)) {
|
||||
error(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
||||
}
|
||||
|
||||
checkHeritageClauseElement(typeRefNode);
|
||||
checkExpressionWithTypeArguments(typeRefNode);
|
||||
if (produceDiagnostics) {
|
||||
let t = getTypeFromHeritageClauseElement(typeRefNode);
|
||||
let t = getTypeFromTypeNode(typeRefNode);
|
||||
if (t !== unknownType) {
|
||||
let declaredType = (t.flags & TypeFlags.Reference) ? (<TypeReference>t).target : t;
|
||||
if (declaredType.flags & (TypeFlags.Class | TypeFlags.Interface)) {
|
||||
@@ -10151,7 +10176,7 @@ module ts {
|
||||
}
|
||||
|
||||
let seen: Map<{ prop: Symbol; containingType: Type }> = {};
|
||||
forEach(type.declaredProperties, p => { seen[p.name] = { prop: p, containingType: type }; });
|
||||
forEach(resolveDeclaredMembers(type).declaredProperties, p => { seen[p.name] = { prop: p, containingType: type }; });
|
||||
let ok = true;
|
||||
|
||||
for (let base of baseTypes) {
|
||||
@@ -10210,11 +10235,11 @@ module ts {
|
||||
}
|
||||
}
|
||||
forEach(getInterfaceBaseTypeNodes(node), heritageElement => {
|
||||
if (!isSupportedHeritageClauseElement(heritageElement)) {
|
||||
if (!isSupportedExpressionWithTypeArguments(heritageElement)) {
|
||||
error(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
||||
}
|
||||
|
||||
checkHeritageClauseElement(heritageElement);
|
||||
checkExpressionWithTypeArguments(heritageElement);
|
||||
});
|
||||
forEach(node.members, checkSourceElement);
|
||||
|
||||
@@ -10512,10 +10537,10 @@ module ts {
|
||||
let firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
|
||||
if (firstNonAmbientClassOrFunc) {
|
||||
if (getSourceFileOfNode(node) !== getSourceFileOfNode(firstNonAmbientClassOrFunc)) {
|
||||
error(node.name, Diagnostics.A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);
|
||||
error(node.name, Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);
|
||||
}
|
||||
else if (node.pos < firstNonAmbientClassOrFunc.pos) {
|
||||
error(node.name, Diagnostics.A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
|
||||
error(node.name, Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10531,10 +10556,10 @@ module ts {
|
||||
// Checks for ambient external modules.
|
||||
if (node.name.kind === SyntaxKind.StringLiteral) {
|
||||
if (!isGlobalSourceFile(node.parent)) {
|
||||
error(node.name, Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules);
|
||||
error(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules);
|
||||
}
|
||||
if (isExternalModuleNameRelative(node.name.text)) {
|
||||
error(node.name, Diagnostics.Ambient_external_module_declaration_cannot_specify_relative_module_name);
|
||||
error(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10566,8 +10591,8 @@ module ts {
|
||||
let inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (<ModuleDeclaration>node.parent.parent).name.kind === SyntaxKind.StringLiteral;
|
||||
if (node.parent.kind !== SyntaxKind.SourceFile && !inAmbientExternalModule) {
|
||||
error(moduleName, node.kind === SyntaxKind.ExportDeclaration ?
|
||||
Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module :
|
||||
Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module);
|
||||
Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :
|
||||
Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
|
||||
return false;
|
||||
}
|
||||
if (inAmbientExternalModule && isExternalModuleNameRelative((<LiteralExpression>moduleName).text)) {
|
||||
@@ -10575,7 +10600,7 @@ module ts {
|
||||
// An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference
|
||||
// other external modules only through top - level external module names.
|
||||
// Relative external module names are not permitted.
|
||||
error(node, Diagnostics.Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name);
|
||||
error(node, Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -10669,14 +10694,14 @@ module ts {
|
||||
|
||||
let inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (<ModuleDeclaration>node.parent.parent).name.kind === SyntaxKind.StringLiteral;
|
||||
if (node.parent.kind !== SyntaxKind.SourceFile && !inAmbientExternalModule) {
|
||||
error(node, Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module);
|
||||
error(node, Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// export * from "foo"
|
||||
let moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
|
||||
if (moduleSymbol && moduleSymbol.exports["export="]) {
|
||||
error(node.moduleSpecifier, Diagnostics.External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
|
||||
error(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10692,7 +10717,7 @@ module ts {
|
||||
function checkExportAssignment(node: ExportAssignment) {
|
||||
let container = node.parent.kind === SyntaxKind.SourceFile ? <SourceFile>node.parent : <ModuleDeclaration>node.parent.parent;
|
||||
if (container.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>container).name.kind === SyntaxKind.Identifier) {
|
||||
error(node, Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module);
|
||||
error(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
|
||||
return;
|
||||
}
|
||||
// Grammar checking
|
||||
@@ -10707,9 +10732,15 @@ module ts {
|
||||
}
|
||||
checkExternalModuleExports(container);
|
||||
|
||||
if (node.isExportEquals && languageVersion >= ScriptTarget.ES6) {
|
||||
// export assignment is deprecated in es6 or above
|
||||
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead);
|
||||
if (node.isExportEquals && !isInAmbientContext(node)) {
|
||||
if (languageVersion >= ScriptTarget.ES6) {
|
||||
// export assignment is deprecated in es6 or above
|
||||
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead);
|
||||
}
|
||||
else if (compilerOptions.module === ModuleKind.System) {
|
||||
// system modules does not support export assignment
|
||||
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11166,7 +11197,7 @@ module ts {
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
return node.parent && node.parent.kind === SyntaxKind.HeritageClauseElement;
|
||||
return node.parent && node.parent.kind === SyntaxKind.ExpressionWithTypeArguments;
|
||||
}
|
||||
|
||||
function isTypeNode(node: Node): boolean {
|
||||
@@ -11186,7 +11217,7 @@ module ts {
|
||||
case SyntaxKind.StringLiteral:
|
||||
// Specialized signatures can have string literals as their parameters' type names
|
||||
return node.parent.kind === SyntaxKind.Parameter;
|
||||
case SyntaxKind.HeritageClauseElement:
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return true;
|
||||
|
||||
// Identifiers and qualified names may be type nodes, depending on their context. Climb
|
||||
@@ -11220,7 +11251,7 @@ module ts {
|
||||
return true;
|
||||
}
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.HeritageClauseElement:
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return true;
|
||||
case SyntaxKind.TypeParameter:
|
||||
return node === (<TypeParameterDeclaration>parent).constraint;
|
||||
@@ -11298,7 +11329,7 @@ module ts {
|
||||
}
|
||||
|
||||
if (isHeritageClauseElementIdentifier(<EntityName>entityName)) {
|
||||
let meaning = entityName.parent.kind === SyntaxKind.HeritageClauseElement ? SymbolFlags.Type : SymbolFlags.Namespace;
|
||||
let meaning = entityName.parent.kind === SyntaxKind.ExpressionWithTypeArguments ? SymbolFlags.Type : SymbolFlags.Namespace;
|
||||
meaning |= SymbolFlags.Alias;
|
||||
return resolveEntityName(<EntityName>entityName, meaning);
|
||||
}
|
||||
@@ -11532,9 +11563,11 @@ module ts {
|
||||
|
||||
function getExportNameSubstitution(symbol: Symbol, location: Node, getGeneratedNameForNode: (Node: Node) => string): string {
|
||||
if (isExternalModuleSymbol(symbol.parent)) {
|
||||
// If this is es6 or higher, just use the name of the export
|
||||
// 1. If this is es6 or higher, just use the name of the export
|
||||
// no need to qualify it.
|
||||
if (languageVersion >= ScriptTarget.ES6) {
|
||||
// 2. export mechanism for System modules is different from CJS\AMD
|
||||
// and it does not need qualifications for exports
|
||||
if (languageVersion >= ScriptTarget.ES6 || compilerOptions.module === ModuleKind.System) {
|
||||
return undefined;
|
||||
}
|
||||
return "exports." + unescapeIdentifier(symbol.name);
|
||||
@@ -11705,7 +11738,7 @@ module ts {
|
||||
// * The serialized type of a TypeReference with a value declaration is its entity name.
|
||||
// * The serialized type of a TypeReference with a call or construct signature is "Function".
|
||||
// * The serialized type of any other type is "Object".
|
||||
let type = getTypeFromTypeReference(node);
|
||||
let type = getTypeFromTypeNode(node);
|
||||
if (type.flags & TypeFlags.Void) {
|
||||
return "void 0";
|
||||
}
|
||||
@@ -11895,6 +11928,15 @@ module ts {
|
||||
return !!resolveName(location, name, SymbolFlags.Value, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
|
||||
}
|
||||
|
||||
function getReferencedValueDeclaration(reference: Identifier): Declaration {
|
||||
Debug.assert(!nodeIsSynthesized(reference));
|
||||
let symbol =
|
||||
getNodeLinks(reference).resolvedSymbol ||
|
||||
resolveName(reference, reference.text, SymbolFlags.Value | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
|
||||
|
||||
return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration;
|
||||
}
|
||||
|
||||
function getBlockScopedVariableId(n: Identifier): number {
|
||||
Debug.assert(!nodeIsSynthesized(n));
|
||||
|
||||
@@ -11953,6 +11995,7 @@ module ts {
|
||||
resolvesToSomeValue,
|
||||
collectLinkedAliases,
|
||||
getBlockScopedVariableId,
|
||||
getReferencedValueDeclaration,
|
||||
serializeTypeOfNode,
|
||||
serializeParameterTypesOfNode,
|
||||
serializeReturnTypeOfNode,
|
||||
@@ -12117,7 +12160,7 @@ module ts {
|
||||
// public // error at public
|
||||
// public.private.package // error at public
|
||||
// B.private.B // no error
|
||||
function checkGrammarHeritageClauseElementInStrictMode(expression: Expression) {
|
||||
function checkGrammarExpressionWithTypeArgumentsInStrictMode(expression: Expression) {
|
||||
// Example:
|
||||
// class C extends public // error at public
|
||||
if (expression && expression.kind === SyntaxKind.Identifier) {
|
||||
@@ -12128,7 +12171,7 @@ module ts {
|
||||
// in PropertyAccessExpression. According to grammar production of MemberExpression,
|
||||
// the left component expression is a PrimaryExpression (i.e. Identifier) while the other
|
||||
// component after dots can be IdentifierName.
|
||||
checkGrammarHeritageClauseElementInStrictMode((<PropertyAccessExpression>expression).expression);
|
||||
checkGrammarExpressionWithTypeArgumentsInStrictMode((<PropertyAccessExpression>expression).expression);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12837,7 +12880,7 @@ module ts {
|
||||
function checkGrammarBindingElement(node: BindingElement) {
|
||||
if (node.dotDotDotToken) {
|
||||
let elements = (<BindingPattern>node.parent).elements;
|
||||
if (node !== elements[elements.length - 1]) {
|
||||
if (node !== lastOrUndefined(elements)) {
|
||||
return grammarErrorOnNode(node, Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,14 @@ module ts {
|
||||
type: "boolean",
|
||||
description: Diagnostics.Print_this_message,
|
||||
},
|
||||
{
|
||||
name: "inlineSourceMap",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "inlineSources",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "listFiles",
|
||||
type: "boolean",
|
||||
@@ -50,17 +58,33 @@ module ts {
|
||||
shortName: "m",
|
||||
type: {
|
||||
"commonjs": ModuleKind.CommonJS,
|
||||
"amd": ModuleKind.AMD
|
||||
"amd": ModuleKind.AMD,
|
||||
"system": ModuleKind.System,
|
||||
"umd": ModuleKind.UMD,
|
||||
},
|
||||
description: Diagnostics.Specify_module_code_generation_Colon_commonjs_or_amd,
|
||||
description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_or_umd,
|
||||
paramType: Diagnostics.KIND,
|
||||
error: Diagnostics.Argument_for_module_option_must_be_commonjs_or_amd
|
||||
error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd
|
||||
},
|
||||
{
|
||||
name: "newLine",
|
||||
type: {
|
||||
"crlf": NewLineKind.CarriageReturnLineFeed,
|
||||
"lf": NewLineKind.LineFeed
|
||||
},
|
||||
description: Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
|
||||
paramType: Diagnostics.NEWLINE,
|
||||
error: Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF
|
||||
},
|
||||
{
|
||||
name: "noEmit",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Do_not_emit_outputs,
|
||||
},
|
||||
{
|
||||
name: "noEmitHelpers",
|
||||
type: "boolean"
|
||||
},
|
||||
{
|
||||
name: "noEmitOnError",
|
||||
type: "boolean",
|
||||
@@ -150,7 +174,7 @@ module ts {
|
||||
type: { "es3": ScriptTarget.ES3, "es5": ScriptTarget.ES5, "es6": ScriptTarget.ES6 },
|
||||
description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental,
|
||||
paramType: Diagnostics.VERSION,
|
||||
error: Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6
|
||||
error: Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES6
|
||||
},
|
||||
{
|
||||
name: "version",
|
||||
@@ -284,12 +308,27 @@ module ts {
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
export function readConfigFile(fileName: string): any {
|
||||
export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } {
|
||||
try {
|
||||
var text = sys.readFile(fileName);
|
||||
return /\S/.test(text) ? JSON.parse(text) : {};
|
||||
}
|
||||
catch (e) {
|
||||
return { error: createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) };
|
||||
}
|
||||
return parseConfigFileText(fileName, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the text of the tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
* @param jsonText The text of the config file
|
||||
*/
|
||||
export function parseConfigFileText(fileName: string, jsonText: string): { config?: any; error?: Diagnostic } {
|
||||
try {
|
||||
return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} };
|
||||
}
|
||||
catch (e) {
|
||||
return { error: createCompilerDiagnostic(Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +338,7 @@ module ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
export function parseConfigFile(json: any, basePath?: string): ParsedCommandLine {
|
||||
export function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine {
|
||||
var errors: Diagnostic[] = [];
|
||||
|
||||
return {
|
||||
@@ -358,7 +397,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
var sysFiles = sys.readDirectory(basePath, ".ts");
|
||||
var sysFiles = host.readDirectory(basePath, ".ts");
|
||||
for (var i = 0; i < sysFiles.length; i++) {
|
||||
var name = sysFiles[i];
|
||||
if (!fileExtensionIs(name, ".d.ts") || !contains(sysFiles, name.substr(0, name.length - 5) + ".ts")) {
|
||||
|
||||
@@ -470,7 +470,7 @@ module ts {
|
||||
let normalized: string[] = [];
|
||||
for (let part of parts) {
|
||||
if (part !== ".") {
|
||||
if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") {
|
||||
if (part === ".." && normalized.length > 0 && lastOrUndefined(normalized) !== "..") {
|
||||
normalized.pop();
|
||||
}
|
||||
else {
|
||||
@@ -586,7 +586,7 @@ module ts {
|
||||
export function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean) {
|
||||
let pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory);
|
||||
let directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory);
|
||||
if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") {
|
||||
if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === "") {
|
||||
// If the directory path given was of type test/cases/ then we really need components of directory to be only till its name
|
||||
// that is ["test", "cases", ""] needs to be actually ["test", "cases"]
|
||||
directoryComponents.length--;
|
||||
|
||||
@@ -37,10 +37,6 @@ module ts {
|
||||
return diagnostics;
|
||||
}
|
||||
|
||||
export function isExternalModuleOrDeclarationFile(sourceFile: SourceFile) {
|
||||
return isExternalModule(sourceFile) || isDeclarationFile(sourceFile);
|
||||
}
|
||||
|
||||
function emitDeclarations(host: EmitHost, resolver: EmitResolver, diagnostics: Diagnostic[], jsFilePath: string, root?: SourceFile): DeclarationEmit {
|
||||
let newLine = host.getNewLine();
|
||||
let compilerOptions = host.getCompilerOptions();
|
||||
@@ -333,8 +329,8 @@ module ts {
|
||||
case SyntaxKind.VoidKeyword:
|
||||
case SyntaxKind.StringLiteral:
|
||||
return writeTextOfNode(currentSourceFile, type);
|
||||
case SyntaxKind.HeritageClauseElement:
|
||||
return emitHeritageClauseElement(<HeritageClauseElement>type);
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return emitExpressionWithTypeArguments(<ExpressionWithTypeArguments>type);
|
||||
case SyntaxKind.TypeReference:
|
||||
return emitTypeReference(<TypeReferenceNode>type);
|
||||
case SyntaxKind.TypeQuery:
|
||||
@@ -380,8 +376,8 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitHeritageClauseElement(node: HeritageClauseElement) {
|
||||
if (isSupportedHeritageClauseElement(node)) {
|
||||
function emitExpressionWithTypeArguments(node: ExpressionWithTypeArguments) {
|
||||
if (isSupportedExpressionWithTypeArguments(node)) {
|
||||
Debug.assert(node.expression.kind === SyntaxKind.Identifier || node.expression.kind === SyntaxKind.PropertyAccessExpression);
|
||||
emitEntityName(<Identifier | PropertyAccessExpression>node.expression);
|
||||
if (node.typeArguments) {
|
||||
@@ -865,14 +861,14 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitHeritageClause(typeReferences: HeritageClauseElement[], isImplementsList: boolean) {
|
||||
function emitHeritageClause(typeReferences: ExpressionWithTypeArguments[], isImplementsList: boolean) {
|
||||
if (typeReferences) {
|
||||
write(isImplementsList ? " implements " : " extends ");
|
||||
emitCommaList(typeReferences, emitTypeOfTypeReference);
|
||||
}
|
||||
|
||||
function emitTypeOfTypeReference(node: HeritageClauseElement) {
|
||||
if (isSupportedHeritageClauseElement(node)) {
|
||||
function emitTypeOfTypeReference(node: ExpressionWithTypeArguments) {
|
||||
if (isSupportedExpressionWithTypeArguments(node)) {
|
||||
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ module ts {
|
||||
A_get_accessor_cannot_have_parameters: { code: 1054, category: DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters." },
|
||||
Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher." },
|
||||
Enum_member_must_have_initializer: { code: 1061, category: DiagnosticCategory.Error, key: "Enum member must have initializer." },
|
||||
An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in an internal module." },
|
||||
An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in a namespace." },
|
||||
Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." },
|
||||
Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." },
|
||||
A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration." },
|
||||
@@ -107,8 +107,8 @@ module ts {
|
||||
or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "'{' or ';' expected." },
|
||||
Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members." },
|
||||
Declaration_expected: { code: 1146, category: DiagnosticCategory.Error, key: "Declaration expected." },
|
||||
Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: DiagnosticCategory.Error, key: "Import declarations in an internal module cannot reference an external module." },
|
||||
Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." },
|
||||
Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: DiagnosticCategory.Error, key: "Import declarations in a namespace cannot reference a module." },
|
||||
Cannot_compile_modules_unless_the_module_flag_is_provided: { code: 1148, category: DiagnosticCategory.Error, key: "Cannot compile modules unless the '--module' flag is provided." },
|
||||
File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: DiagnosticCategory.Error, key: "File name '{0}' differs from already included file name '{1}' only in casing" },
|
||||
new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead." },
|
||||
var_let_or_const_expected: { code: 1152, category: DiagnosticCategory.Error, key: "'var', 'let' or 'const' expected." },
|
||||
@@ -150,9 +150,9 @@ module ts {
|
||||
The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...in' statement cannot have an initializer." },
|
||||
The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." },
|
||||
An_import_declaration_cannot_have_modifiers: { code: 1191, category: DiagnosticCategory.Error, key: "An import declaration cannot have modifiers." },
|
||||
External_module_0_has_no_default_export: { code: 1192, category: DiagnosticCategory.Error, key: "External module '{0}' has no default export." },
|
||||
Module_0_has_no_default_export: { code: 1192, category: DiagnosticCategory.Error, key: "Module '{0}' has no default export." },
|
||||
An_export_declaration_cannot_have_modifiers: { code: 1193, category: DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." },
|
||||
Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: DiagnosticCategory.Error, key: "Export declarations are not permitted in an internal module." },
|
||||
Export_declarations_are_not_permitted_in_a_namespace: { code: 1194, category: DiagnosticCategory.Error, key: "Export declarations are not permitted in a namespace." },
|
||||
Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: DiagnosticCategory.Error, key: "Catch clause variable name must be an identifier." },
|
||||
Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have a type annotation." },
|
||||
Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have an initializer." },
|
||||
@@ -161,28 +161,27 @@ module ts {
|
||||
Line_terminator_not_permitted_before_arrow: { code: 1200, category: DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." },
|
||||
Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." },
|
||||
Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." },
|
||||
Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile external modules into amd or commonjs when targeting es6 or higher." },
|
||||
Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." },
|
||||
Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
|
||||
Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." },
|
||||
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
|
||||
Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." },
|
||||
Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--separateCompilation' flag is provided." },
|
||||
Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." },
|
||||
Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." },
|
||||
A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" },
|
||||
Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode" },
|
||||
Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
|
||||
Identifier_expected_0_is_a_reserved_word_in_strict_mode_External_Module_is_automatically_in_strict_mode: { code: 1214, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. External Module is automatically in strict mode." },
|
||||
Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" },
|
||||
Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
|
||||
Type_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode: { code: 1217, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode." },
|
||||
Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." },
|
||||
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
|
||||
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
|
||||
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
|
||||
Circular_definition_of_import_alias_0: { code: 2303, category: DiagnosticCategory.Error, key: "Circular definition of import alias '{0}'." },
|
||||
Cannot_find_name_0: { code: 2304, category: DiagnosticCategory.Error, key: "Cannot find name '{0}'." },
|
||||
Module_0_has_no_exported_member_1: { code: 2305, category: DiagnosticCategory.Error, key: "Module '{0}' has no exported member '{1}'." },
|
||||
File_0_is_not_an_external_module: { code: 2306, category: DiagnosticCategory.Error, key: "File '{0}' is not an external module." },
|
||||
Cannot_find_external_module_0: { code: 2307, category: DiagnosticCategory.Error, key: "Cannot find external module '{0}'." },
|
||||
File_0_is_not_a_module: { code: 2306, category: DiagnosticCategory.Error, key: "File '{0}' is not a module." },
|
||||
Cannot_find_module_0: { code: 2307, category: DiagnosticCategory.Error, key: "Cannot find module '{0}'." },
|
||||
A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: DiagnosticCategory.Error, key: "A module cannot have more than one export assignment." },
|
||||
An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in a module with other exported elements." },
|
||||
Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: DiagnosticCategory.Error, key: "Type '{0}' recursively references itself as a base type." },
|
||||
@@ -205,7 +204,7 @@ module ts {
|
||||
Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible." },
|
||||
Index_signature_is_missing_in_type_0: { code: 2329, category: DiagnosticCategory.Error, key: "Index signature is missing in type '{0}'." },
|
||||
Index_signatures_are_incompatible: { code: 2330, category: DiagnosticCategory.Error, key: "Index signatures are incompatible." },
|
||||
this_cannot_be_referenced_in_a_module_body: { code: 2331, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a module body." },
|
||||
this_cannot_be_referenced_in_a_module_or_namespace_body: { code: 2331, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a module or namespace body." },
|
||||
this_cannot_be_referenced_in_current_location: { code: 2332, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in current location." },
|
||||
this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in constructor arguments." },
|
||||
this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a static property initializer." },
|
||||
@@ -297,15 +296,15 @@ module ts {
|
||||
Interface_0_incorrectly_extends_interface_1: { code: 2430, category: DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}'." },
|
||||
Enum_name_cannot_be_0: { code: 2431, category: DiagnosticCategory.Error, key: "Enum name cannot be '{0}'" },
|
||||
In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: DiagnosticCategory.Error, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." },
|
||||
A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: DiagnosticCategory.Error, key: "A module declaration cannot be in a different file from a class or function with which it is merged" },
|
||||
A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: DiagnosticCategory.Error, key: "A module declaration cannot be located prior to a class or function with which it is merged" },
|
||||
Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: DiagnosticCategory.Error, key: "Ambient external modules cannot be nested in other modules." },
|
||||
Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: DiagnosticCategory.Error, key: "Ambient external module declaration cannot specify relative module name." },
|
||||
A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: DiagnosticCategory.Error, key: "A namespace declaration cannot be in a different file from a class or function with which it is merged" },
|
||||
A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: DiagnosticCategory.Error, key: "A namespace declaration cannot be located prior to a class or function with which it is merged" },
|
||||
Ambient_modules_cannot_be_nested_in_other_modules: { code: 2435, category: DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules." },
|
||||
Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: DiagnosticCategory.Error, key: "Ambient module declaration cannot specify relative module name." },
|
||||
Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" },
|
||||
Import_name_cannot_be_0: { code: 2438, category: DiagnosticCategory.Error, key: "Import name cannot be '{0}'" },
|
||||
Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: DiagnosticCategory.Error, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." },
|
||||
Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: DiagnosticCategory.Error, key: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." },
|
||||
Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: DiagnosticCategory.Error, key: "Import declaration conflicts with local declaration of '{0}'" },
|
||||
Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." },
|
||||
Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." },
|
||||
Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: DiagnosticCategory.Error, key: "Types have separate declarations of a private property '{0}'." },
|
||||
Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: DiagnosticCategory.Error, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." },
|
||||
Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: DiagnosticCategory.Error, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." },
|
||||
@@ -359,11 +358,13 @@ module ts {
|
||||
Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: DiagnosticCategory.Error, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." },
|
||||
Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type or a string type." },
|
||||
The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { code: 2496, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression." },
|
||||
External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." },
|
||||
External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." },
|
||||
Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: DiagnosticCategory.Error, key: "Module '{0}' resolves to a non-module entity and cannot be imported using this construct." },
|
||||
Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: DiagnosticCategory.Error, key: "Module '{0}' uses 'export =' and cannot be used with 'export *'." },
|
||||
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
|
||||
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
|
||||
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
|
||||
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
|
||||
Cannot_find_namespace_0: { code: 2503, category: DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
@@ -439,6 +440,7 @@ module ts {
|
||||
Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." },
|
||||
Cannot_read_file_0_Colon_1: { code: 5012, category: DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" },
|
||||
Unsupported_file_encoding: { code: 5013, category: DiagnosticCategory.Error, key: "Unsupported file encoding." },
|
||||
Failed_to_parse_file_0_Colon_1: { code: 5014, category: DiagnosticCategory.Error, key: "Failed to parse file '{0}': {1}." },
|
||||
Unknown_compiler_option_0: { code: 5023, category: DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." },
|
||||
Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." },
|
||||
Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
|
||||
@@ -452,6 +454,10 @@ module ts {
|
||||
Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." },
|
||||
Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." },
|
||||
Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." },
|
||||
Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." },
|
||||
Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." },
|
||||
Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." },
|
||||
Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." },
|
||||
Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." },
|
||||
Generates_corresponding_d_ts_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." },
|
||||
Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." },
|
||||
@@ -463,7 +469,7 @@ module ts {
|
||||
Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." },
|
||||
Do_not_emit_outputs: { code: 6010, category: DiagnosticCategory.Message, key: "Do not emit outputs." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
|
||||
Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs' or 'amd'" },
|
||||
Specify_module_code_generation_Colon_commonjs_amd_system_or_umd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'" },
|
||||
Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." },
|
||||
Print_the_compiler_s_version: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version." },
|
||||
Compile_the_project_in_the_given_directory: { code: 6020, category: DiagnosticCategory.Message, key: "Compile the project in the given directory." },
|
||||
@@ -484,8 +490,8 @@ module ts {
|
||||
Generates_corresponding_map_file: { code: 6043, category: DiagnosticCategory.Message, key: "Generates corresponding '.map' file." },
|
||||
Compiler_option_0_expects_an_argument: { code: 6044, category: DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." },
|
||||
Unterminated_quoted_string_in_response_file_0: { code: 6045, category: DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." },
|
||||
Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs' or 'amd'." },
|
||||
Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." },
|
||||
Argument_for_module_option_must_be_commonjs_amd_system_or_umd: { code: 6046, category: DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'." },
|
||||
Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: DiagnosticCategory.Error, key: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'." },
|
||||
Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: DiagnosticCategory.Error, key: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." },
|
||||
Unsupported_locale_0: { code: 6049, category: DiagnosticCategory.Error, key: "Unsupported locale '{0}'." },
|
||||
Unable_to_open_file_0: { code: 6050, category: DiagnosticCategory.Error, key: "Unable to open file '{0}'." },
|
||||
@@ -498,6 +504,9 @@ module ts {
|
||||
Preserve_new_lines_when_emitting_code: { code: 6057, category: DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
|
||||
Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." },
|
||||
File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." },
|
||||
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
|
||||
NEWLINE: { code: 6061, category: DiagnosticCategory.Message, key: "NEWLINE" },
|
||||
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
|
||||
Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
|
||||
@@ -510,7 +519,6 @@ module ts {
|
||||
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
|
||||
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
|
||||
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
|
||||
_0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." },
|
||||
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
|
||||
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
"category": "Error",
|
||||
"code": 1061
|
||||
},
|
||||
"An export assignment cannot be used in an internal module.": {
|
||||
"An export assignment cannot be used in a namespace.": {
|
||||
"category": "Error",
|
||||
"code": 1063
|
||||
},
|
||||
@@ -415,11 +415,11 @@
|
||||
"category": "Error",
|
||||
"code": 1146
|
||||
},
|
||||
"Import declarations in an internal module cannot reference an external module.": {
|
||||
"Import declarations in a namespace cannot reference a module.": {
|
||||
"category": "Error",
|
||||
"code": 1147
|
||||
},
|
||||
"Cannot compile external modules unless the '--module' flag is provided.": {
|
||||
"Cannot compile modules unless the '--module' flag is provided.": {
|
||||
"category": "Error",
|
||||
"code": 1148
|
||||
},
|
||||
@@ -587,7 +587,7 @@
|
||||
"category": "Error",
|
||||
"code": 1191
|
||||
},
|
||||
"External module '{0}' has no default export.": {
|
||||
"Module '{0}' has no default export.": {
|
||||
"category": "Error",
|
||||
"code": 1192
|
||||
},
|
||||
@@ -595,7 +595,7 @@
|
||||
"category": "Error",
|
||||
"code": 1193
|
||||
},
|
||||
"Export declarations are not permitted in an internal module.": {
|
||||
"Export declarations are not permitted in a namespace.": {
|
||||
"category": "Error",
|
||||
"code": 1194
|
||||
},
|
||||
@@ -631,7 +631,7 @@
|
||||
"category": "Error",
|
||||
"code": 1203
|
||||
},
|
||||
"Cannot compile external modules into amd or commonjs when targeting es6 or higher.": {
|
||||
"Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.": {
|
||||
"category": "Error",
|
||||
"code": 1204
|
||||
},
|
||||
@@ -647,7 +647,7 @@
|
||||
"category": "Error",
|
||||
"code": 1207
|
||||
},
|
||||
"Cannot compile non-external modules when the '--separateCompilation' flag is provided.": {
|
||||
"Cannot compile namespaces when the '--separateCompilation' flag is provided.": {
|
||||
"category": "Error",
|
||||
"code": 1208
|
||||
},
|
||||
@@ -671,10 +671,6 @@
|
||||
"category": "Error",
|
||||
"code": 1213
|
||||
},
|
||||
"Identifier expected. '{0}' is a reserved word in strict mode. External Module is automatically in strict mode.": {
|
||||
"category": "Error",
|
||||
"code": 1214
|
||||
},
|
||||
"Type expected. '{0}' is a reserved word in strict mode": {
|
||||
"category": "Error",
|
||||
"code": 1215
|
||||
@@ -683,10 +679,11 @@
|
||||
"category": "Error",
|
||||
"code": 1216
|
||||
},
|
||||
"Type expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode.": {
|
||||
"Export assignment is not supported when '--module' flag is 'system'.": {
|
||||
"category": "Error",
|
||||
"code": 1217
|
||||
"code": 1218
|
||||
},
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2300
|
||||
@@ -711,11 +708,11 @@
|
||||
"category": "Error",
|
||||
"code": 2305
|
||||
},
|
||||
"File '{0}' is not an external module.": {
|
||||
"File '{0}' is not a module.": {
|
||||
"category": "Error",
|
||||
"code": 2306
|
||||
},
|
||||
"Cannot find external module '{0}'.": {
|
||||
"Cannot find module '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2307
|
||||
},
|
||||
@@ -807,7 +804,7 @@
|
||||
"category": "Error",
|
||||
"code": 2330
|
||||
},
|
||||
"'this' cannot be referenced in a module body.": {
|
||||
"'this' cannot be referenced in a module or namespace body.": {
|
||||
"category": "Error",
|
||||
"code": 2331
|
||||
},
|
||||
@@ -1175,19 +1172,19 @@
|
||||
"category": "Error",
|
||||
"code": 2432
|
||||
},
|
||||
"A module declaration cannot be in a different file from a class or function with which it is merged": {
|
||||
"A namespace declaration cannot be in a different file from a class or function with which it is merged": {
|
||||
"category": "Error",
|
||||
"code": 2433
|
||||
},
|
||||
"A module declaration cannot be located prior to a class or function with which it is merged": {
|
||||
"A namespace declaration cannot be located prior to a class or function with which it is merged": {
|
||||
"category": "Error",
|
||||
"code": 2434
|
||||
},
|
||||
"Ambient external modules cannot be nested in other modules.": {
|
||||
"Ambient modules cannot be nested in other modules.": {
|
||||
"category": "Error",
|
||||
"code": 2435
|
||||
},
|
||||
"Ambient external module declaration cannot specify relative module name.": {
|
||||
"Ambient module declaration cannot specify relative module name.": {
|
||||
"category": "Error",
|
||||
"code": 2436
|
||||
},
|
||||
@@ -1199,7 +1196,7 @@
|
||||
"category": "Error",
|
||||
"code": 2438
|
||||
},
|
||||
"Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name.": {
|
||||
"Import or export declaration in an ambient module declaration cannot reference module through relative module name.": {
|
||||
"category": "Error",
|
||||
"code": 2439
|
||||
},
|
||||
@@ -1207,7 +1204,7 @@
|
||||
"category": "Error",
|
||||
"code": 2440
|
||||
},
|
||||
"Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module.": {
|
||||
"Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module.": {
|
||||
"category": "Error",
|
||||
"code": 2441
|
||||
},
|
||||
@@ -1423,11 +1420,11 @@
|
||||
"category": "Error",
|
||||
"code": 2496
|
||||
},
|
||||
"External module '{0}' resolves to a non-module entity and cannot be imported using this construct.": {
|
||||
"Module '{0}' resolves to a non-module entity and cannot be imported using this construct.": {
|
||||
"category": "Error",
|
||||
"code": 2497
|
||||
},
|
||||
"External module '{0}' uses 'export =' and cannot be used with 'export *'.": {
|
||||
"Module '{0}' uses 'export =' and cannot be used with 'export *'.": {
|
||||
"category": "Error",
|
||||
"code": 2498
|
||||
},
|
||||
@@ -1443,6 +1440,14 @@
|
||||
"category": "Error",
|
||||
"code": 2501
|
||||
},
|
||||
"'{0}' is referenced directly or indirectly in its own type annotation.": {
|
||||
"category": "Error",
|
||||
"code": 2502
|
||||
},
|
||||
"Cannot find namespace '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2503
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
@@ -1744,6 +1749,10 @@
|
||||
"category": "Error",
|
||||
"code": 5013
|
||||
},
|
||||
"Failed to parse file '{0}': {1}.": {
|
||||
"category": "Error",
|
||||
"code": 5014
|
||||
},
|
||||
"Unknown compiler option '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 5023
|
||||
@@ -1796,6 +1805,23 @@
|
||||
"category": "Error",
|
||||
"code": 5047
|
||||
},
|
||||
"Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.": {
|
||||
"category": "Error",
|
||||
"code": 5048
|
||||
},
|
||||
"Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.": {
|
||||
"category": "Error",
|
||||
"code": 5049
|
||||
},
|
||||
"Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.": {
|
||||
"category": "Error",
|
||||
"code": 5050
|
||||
},
|
||||
"Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.": {
|
||||
"category": "Error",
|
||||
"code": 5051
|
||||
},
|
||||
|
||||
"Concatenate and emit output to single file.": {
|
||||
"category": "Message",
|
||||
"code": 6001
|
||||
@@ -1840,7 +1866,7 @@
|
||||
"category": "Message",
|
||||
"code": 6015
|
||||
},
|
||||
"Specify module code generation: 'commonjs' or 'amd'": {
|
||||
"Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'": {
|
||||
"category": "Message",
|
||||
"code": 6016
|
||||
},
|
||||
@@ -1924,11 +1950,11 @@
|
||||
"category": "Error",
|
||||
"code": 6045
|
||||
},
|
||||
"Argument for '--module' option must be 'commonjs' or 'amd'.": {
|
||||
"Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'.": {
|
||||
"category": "Error",
|
||||
"code": 6046
|
||||
},
|
||||
"Argument for '--target' option must be 'es3', 'es5', or 'es6'.": {
|
||||
"Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'.": {
|
||||
"category": "Error",
|
||||
"code": 6047
|
||||
},
|
||||
@@ -1980,6 +2006,18 @@
|
||||
"category": "Error",
|
||||
"code": 6059
|
||||
},
|
||||
"Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix).": {
|
||||
"category": "Message",
|
||||
"code": 6060
|
||||
},
|
||||
"NEWLINE": {
|
||||
"category": "Message",
|
||||
"code": 6061
|
||||
},
|
||||
"Argument for '--newLine' option must be 'CRLF' or 'LF'.": {
|
||||
"category": "Error",
|
||||
"code": 6062
|
||||
},
|
||||
|
||||
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
@@ -2030,10 +2068,6 @@
|
||||
"category": "Error",
|
||||
"code": 7020
|
||||
},
|
||||
"'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.": {
|
||||
"category": "Error",
|
||||
"code": 7021
|
||||
},
|
||||
"'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.": {
|
||||
"category": "Error",
|
||||
"code": 7022
|
||||
|
||||
+1037
-265
File diff suppressed because it is too large
Load Diff
+25
-15
@@ -194,7 +194,7 @@ module ts {
|
||||
case SyntaxKind.ForStatement:
|
||||
return visitNode(cbNode, (<ForStatement>node).initializer) ||
|
||||
visitNode(cbNode, (<ForStatement>node).condition) ||
|
||||
visitNode(cbNode, (<ForStatement>node).iterator) ||
|
||||
visitNode(cbNode, (<ForStatement>node).incrementor) ||
|
||||
visitNode(cbNode, (<ForStatement>node).statement);
|
||||
case SyntaxKind.ForInStatement:
|
||||
return visitNode(cbNode, (<ForInStatement>node).initializer) ||
|
||||
@@ -308,9 +308,9 @@ module ts {
|
||||
return visitNode(cbNode, (<ComputedPropertyName>node).expression);
|
||||
case SyntaxKind.HeritageClause:
|
||||
return visitNodes(cbNodes, (<HeritageClause>node).types);
|
||||
case SyntaxKind.HeritageClauseElement:
|
||||
return visitNode(cbNode, (<HeritageClauseElement>node).expression) ||
|
||||
visitNodes(cbNodes, (<HeritageClauseElement>node).typeArguments);
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return visitNode(cbNode, (<ExpressionWithTypeArguments>node).expression) ||
|
||||
visitNodes(cbNodes, (<ExpressionWithTypeArguments>node).typeArguments);
|
||||
case SyntaxKind.ExternalModuleReference:
|
||||
return visitNode(cbNode, (<ExternalModuleReference>node).expression);
|
||||
case SyntaxKind.MissingDeclaration:
|
||||
@@ -1691,7 +1691,7 @@ module ts {
|
||||
do {
|
||||
templateSpans.push(parseTemplateSpan());
|
||||
}
|
||||
while (templateSpans[templateSpans.length - 1].literal.kind === SyntaxKind.TemplateMiddle)
|
||||
while (lastOrUndefined(templateSpans).literal.kind === SyntaxKind.TemplateMiddle)
|
||||
|
||||
templateSpans.end = getNodeEnd();
|
||||
template.templateSpans = templateSpans;
|
||||
@@ -3497,7 +3497,7 @@ module ts {
|
||||
}
|
||||
parseExpected(SyntaxKind.SemicolonToken);
|
||||
if (token !== SyntaxKind.CloseParenToken) {
|
||||
forStatement.iterator = allowInAnd(parseExpression);
|
||||
forStatement.incrementor = allowInAnd(parseExpression);
|
||||
}
|
||||
parseExpected(SyntaxKind.CloseParenToken);
|
||||
forOrForInOrForOfStatement = forStatement;
|
||||
@@ -3704,6 +3704,7 @@ module ts {
|
||||
return !isConstEnum;
|
||||
case SyntaxKind.InterfaceKeyword:
|
||||
case SyntaxKind.ModuleKeyword:
|
||||
case SyntaxKind.NamespaceKeyword:
|
||||
case SyntaxKind.EnumKeyword:
|
||||
case SyntaxKind.TypeKeyword:
|
||||
// When followed by an identifier, these do not start a statement but might
|
||||
@@ -4283,15 +4284,15 @@ module ts {
|
||||
let node = <HeritageClause>createNode(SyntaxKind.HeritageClause);
|
||||
node.token = token;
|
||||
nextToken();
|
||||
node.types = parseDelimitedList(ParsingContext.HeritageClauseElement, parseHeritageClauseElement);
|
||||
node.types = parseDelimitedList(ParsingContext.HeritageClauseElement, parseExpressionWithTypeArguments);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function parseHeritageClauseElement(): HeritageClauseElement {
|
||||
let node = <HeritageClauseElement>createNode(SyntaxKind.HeritageClauseElement);
|
||||
function parseExpressionWithTypeArguments(): ExpressionWithTypeArguments {
|
||||
let node = <ExpressionWithTypeArguments>createNode(SyntaxKind.ExpressionWithTypeArguments);
|
||||
node.expression = parseLeftHandSideExpressionOrHigher();
|
||||
if (token === SyntaxKind.LessThanToken) {
|
||||
node.typeArguments = parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken);
|
||||
@@ -4371,14 +4372,14 @@ module ts {
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseInternalModuleTail(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, flags: NodeFlags): ModuleDeclaration {
|
||||
function parseModuleOrNamespaceDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, flags: NodeFlags): ModuleDeclaration {
|
||||
let node = <ModuleDeclaration>createNode(SyntaxKind.ModuleDeclaration, fullStart);
|
||||
node.decorators = decorators;
|
||||
setModifiers(node, modifiers);
|
||||
node.flags |= flags;
|
||||
node.name = parseIdentifier();
|
||||
node.body = parseOptional(SyntaxKind.DotToken)
|
||||
? parseInternalModuleTail(getNodePos(), /*decorators*/ undefined, /*modifiers:*/undefined, NodeFlags.Export)
|
||||
? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers:*/undefined, NodeFlags.Export)
|
||||
: parseModuleBlock();
|
||||
return finishNode(node);
|
||||
}
|
||||
@@ -4393,10 +4394,17 @@ module ts {
|
||||
}
|
||||
|
||||
function parseModuleDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ModuleDeclaration {
|
||||
parseExpected(SyntaxKind.ModuleKeyword);
|
||||
return token === SyntaxKind.StringLiteral
|
||||
? parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers)
|
||||
: parseInternalModuleTail(fullStart, decorators, modifiers, modifiers ? modifiers.flags : 0);
|
||||
let flags = modifiers ? modifiers.flags : 0;
|
||||
if (parseOptional(SyntaxKind.NamespaceKeyword)) {
|
||||
flags |= NodeFlags.Namespace;
|
||||
}
|
||||
else {
|
||||
parseExpected(SyntaxKind.ModuleKeyword);
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);
|
||||
}
|
||||
}
|
||||
return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags);
|
||||
}
|
||||
|
||||
function isExternalModuleReference() {
|
||||
@@ -4631,6 +4639,7 @@ module ts {
|
||||
// Not true keywords so ensure an identifier follows or is string literal or asterisk or open brace
|
||||
return lookAhead(nextTokenCanFollowImportKeyword);
|
||||
case SyntaxKind.ModuleKeyword:
|
||||
case SyntaxKind.NamespaceKeyword:
|
||||
// Not a true keyword so ensure an identifier or string literal follows
|
||||
return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral);
|
||||
case SyntaxKind.ExportKeyword:
|
||||
@@ -4715,6 +4724,7 @@ module ts {
|
||||
case SyntaxKind.EnumKeyword:
|
||||
return parseEnumDeclaration(fullStart, decorators, modifiers);
|
||||
case SyntaxKind.ModuleKeyword:
|
||||
case SyntaxKind.NamespaceKeyword:
|
||||
return parseModuleDeclaration(fullStart, decorators, modifiers);
|
||||
case SyntaxKind.ImportKeyword:
|
||||
return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);
|
||||
|
||||
+34
-7
@@ -10,6 +10,9 @@ module ts {
|
||||
/** The version of the TypeScript compiler release */
|
||||
export const version = "1.5.0-beta";
|
||||
|
||||
const carriageReturnLineFeed = "\r\n";
|
||||
const lineFeed = "\n";
|
||||
|
||||
export function findConfigFile(searchPath: string): string {
|
||||
var fileName = "tsconfig.json";
|
||||
while (true) {
|
||||
@@ -91,6 +94,11 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
let newLine =
|
||||
options.newLine === NewLineKind.CarriageReturnLineFeed ? carriageReturnLineFeed :
|
||||
options.newLine === NewLineKind.LineFeed ? lineFeed :
|
||||
sys.newLine;
|
||||
|
||||
return {
|
||||
getSourceFile,
|
||||
getDefaultLibFileName: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), getDefaultLibFileName(options)),
|
||||
@@ -98,15 +106,15 @@ module ts {
|
||||
getCurrentDirectory: () => currentDirectory || (currentDirectory = sys.getCurrentDirectory()),
|
||||
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
|
||||
getCanonicalFileName,
|
||||
getNewLine: () => sys.newLine
|
||||
getNewLine: () => newLine
|
||||
};
|
||||
}
|
||||
|
||||
export function getPreEmitDiagnostics(program: Program): Diagnostic[] {
|
||||
let diagnostics = program.getSyntacticDiagnostics().concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics());
|
||||
export function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile): Diagnostic[] {
|
||||
let diagnostics = program.getSyntacticDiagnostics(sourceFile).concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics(sourceFile));
|
||||
|
||||
if (program.getCompilerOptions().declaration) {
|
||||
diagnostics.concat(program.getDeclarationDiagnostics());
|
||||
diagnostics.concat(program.getDeclarationDiagnostics(sourceFile));
|
||||
}
|
||||
|
||||
return sortAndDeduplicateDiagnostics(diagnostics);
|
||||
@@ -534,6 +542,25 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (options.inlineSourceMap) {
|
||||
if (options.sourceMap) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap));
|
||||
}
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (options.inlineSources) {
|
||||
if (!options.sourceMap && !options.inlineSourceMap) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided));
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
|
||||
// Error to specify --mapRoot or --sourceRoot without mapSourceFiles
|
||||
if (options.mapRoot) {
|
||||
@@ -556,18 +583,18 @@ module ts {
|
||||
let firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) && !isDeclarationFile(f) ? f : undefined);
|
||||
if (firstNonExternalModuleSourceFile) {
|
||||
let span = getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
|
||||
diagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided));
|
||||
diagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided));
|
||||
}
|
||||
}
|
||||
else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && !options.module) {
|
||||
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
|
||||
let span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
|
||||
diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided));
|
||||
diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
|
||||
}
|
||||
|
||||
// Cannot specify module gen target when in es6 or above
|
||||
if (options.module && languageVersion >= ScriptTarget.ES6) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher));
|
||||
}
|
||||
|
||||
// there has to be common source directory if user specified --outdir || --sourceRoot
|
||||
|
||||
@@ -2,12 +2,10 @@
|
||||
/// <reference path="diagnosticInformationMap.generated.ts"/>
|
||||
|
||||
module ts {
|
||||
/* @internal */
|
||||
export interface ErrorCallback {
|
||||
(message: DiagnosticMessage, length: number): void;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface Scanner {
|
||||
getStartPos(): number;
|
||||
getToken(): SyntaxKind;
|
||||
@@ -76,6 +74,7 @@ module ts {
|
||||
"interface": SyntaxKind.InterfaceKeyword,
|
||||
"let": SyntaxKind.LetKeyword,
|
||||
"module": SyntaxKind.ModuleKeyword,
|
||||
"namespace": SyntaxKind.NamespaceKeyword,
|
||||
"new": SyntaxKind.NewKeyword,
|
||||
"null": SyntaxKind.NullKeyword,
|
||||
"number": SyntaxKind.NumberKeyword,
|
||||
@@ -352,7 +351,7 @@ module ts {
|
||||
export function isLineBreak(ch: number): boolean {
|
||||
// ES5 7.3:
|
||||
// The ECMAScript line terminator characters are listed in Table 3.
|
||||
// Table 3 — Line Terminator Characters
|
||||
// Table 3: Line Terminator Characters
|
||||
// Code Unit Value Name Formal Name
|
||||
// \u000A Line Feed <LF>
|
||||
// \u000D Carriage Return <CR>
|
||||
@@ -521,7 +520,7 @@ module ts {
|
||||
}
|
||||
collecting = true;
|
||||
if (result && result.length) {
|
||||
result[result.length - 1].hasTrailingNewLine = true;
|
||||
lastOrUndefined(result).hasTrailingNewLine = true;
|
||||
}
|
||||
continue;
|
||||
case CharacterCodes.tab:
|
||||
@@ -568,7 +567,7 @@ module ts {
|
||||
default:
|
||||
if (ch > CharacterCodes.maxAsciiCharacter && (isWhiteSpace(ch) || isLineBreak(ch))) {
|
||||
if (result && result.length && isLineBreak(ch)) {
|
||||
result[result.length - 1].hasTrailingNewLine = true;
|
||||
lastOrUndefined(result).hasTrailingNewLine = true;
|
||||
}
|
||||
pos++;
|
||||
continue;
|
||||
@@ -599,8 +598,7 @@ module ts {
|
||||
ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierPart(ch, languageVersion);
|
||||
}
|
||||
|
||||
// Creates a scanner over a (possibly unspecified) range of a piece of text.
|
||||
/* @internal */
|
||||
/** Creates a scanner over a (possibly unspecified) range of a piece of text. */
|
||||
export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner {
|
||||
let pos: number; // Current position (end position of text of current token)
|
||||
let end: number; // end of text
|
||||
|
||||
+8
-5
@@ -208,12 +208,15 @@ module ts {
|
||||
|
||||
if (!cachedProgram) {
|
||||
if (configFileName) {
|
||||
var configObject = readConfigFile(configFileName);
|
||||
if (!configObject) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, configFileName));
|
||||
|
||||
let result = readConfigFile(configFileName);
|
||||
if (result.error) {
|
||||
reportDiagnostic(result.error);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
var configParseResult = parseConfigFile(configObject, getDirectoryPath(configFileName));
|
||||
|
||||
let configObject = result.config;
|
||||
let configParseResult = parseConfigFile(configObject, sys, getDirectoryPath(configFileName));
|
||||
if (configParseResult.errors.length > 0) {
|
||||
reportDiagnostics(configParseResult.errors);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
@@ -230,7 +233,7 @@ module ts {
|
||||
compilerHost.getSourceFile = getSourceFile;
|
||||
}
|
||||
|
||||
var compileResult = compile(rootFileNames, compilerOptions, compilerHost);
|
||||
let compileResult = compile(rootFileNames, compilerOptions, compilerHost);
|
||||
|
||||
if (!compilerOptions.watch) {
|
||||
return sys.exit(compileResult.exitStatus);
|
||||
|
||||
+40
-18
@@ -138,6 +138,7 @@ module ts {
|
||||
DeclareKeyword,
|
||||
GetKeyword,
|
||||
ModuleKeyword,
|
||||
NamespaceKeyword,
|
||||
RequireKeyword,
|
||||
NumberKeyword,
|
||||
SetKeyword,
|
||||
@@ -205,9 +206,9 @@ module ts {
|
||||
SpreadElementExpression,
|
||||
ClassExpression,
|
||||
OmittedExpression,
|
||||
ExpressionWithTypeArguments,
|
||||
// Misc
|
||||
TemplateSpan,
|
||||
HeritageClauseElement,
|
||||
SemicolonClassElement,
|
||||
// Element
|
||||
Block,
|
||||
@@ -312,8 +313,9 @@ module ts {
|
||||
DeclarationFile = 0x00000800, // Node is a .d.ts file
|
||||
Let = 0x00001000, // Variable declaration
|
||||
Const = 0x00002000, // Variable declaration
|
||||
OctalLiteral = 0x00004000,
|
||||
ExportContext = 0x00008000, // Export context (initialized by binding)
|
||||
OctalLiteral = 0x00004000, // Octal numeric literal
|
||||
Namespace = 0x00008000, // Namespace declaration
|
||||
ExportContext = 0x00010000, // Export context (initialized by binding)
|
||||
|
||||
Modifier = Export | Ambient | Public | Private | Protected | Static | Default,
|
||||
AccessibilityModifier = Public | Private | Protected,
|
||||
@@ -739,7 +741,7 @@ module ts {
|
||||
arguments: NodeArray<Expression>;
|
||||
}
|
||||
|
||||
export interface HeritageClauseElement extends TypeNode {
|
||||
export interface ExpressionWithTypeArguments extends TypeNode {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
}
|
||||
@@ -795,7 +797,7 @@ module ts {
|
||||
export interface ForStatement extends IterationStatement {
|
||||
initializer?: VariableDeclarationList | Expression;
|
||||
condition?: Expression;
|
||||
iterator?: Expression;
|
||||
incrementor?: Expression;
|
||||
}
|
||||
|
||||
export interface ForInStatement extends IterationStatement {
|
||||
@@ -891,7 +893,7 @@ module ts {
|
||||
|
||||
export interface HeritageClause extends Node {
|
||||
token: SyntaxKind;
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
types?: NodeArray<ExpressionWithTypeArguments>;
|
||||
}
|
||||
|
||||
export interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
@@ -1032,6 +1034,10 @@ module ts {
|
||||
getCurrentDirectory(): string;
|
||||
}
|
||||
|
||||
export interface ParseConfigHost {
|
||||
readDirectory(rootDir: string, extension: string): string[];
|
||||
}
|
||||
|
||||
export interface WriteFileCallback {
|
||||
(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
|
||||
}
|
||||
@@ -1092,14 +1098,15 @@ module ts {
|
||||
}
|
||||
|
||||
export interface SourceMapData {
|
||||
sourceMapFilePath: string; // Where the sourcemap file is written
|
||||
jsSourceMappingURL: string; // source map URL written in the .js file
|
||||
sourceMapFile: string; // Source map's file field - .js file name
|
||||
sourceMapSourceRoot: string; // Source map's sourceRoot field - location where the sources will be present if not ""
|
||||
sourceMapSources: string[]; // Source map's sources field - list of sources that can be indexed in this source map
|
||||
inputSourceFileNames: string[]; // Input source file (which one can use on program to get the file), 1:1 mapping with the sourceMapSources list
|
||||
sourceMapNames?: string[]; // Source map's names field - list of names that can be indexed in this source map
|
||||
sourceMapMappings: string; // Source map's mapping field - encoded source map spans
|
||||
sourceMapFilePath: string; // Where the sourcemap file is written
|
||||
jsSourceMappingURL: string; // source map URL written in the .js file
|
||||
sourceMapFile: string; // Source map's file field - .js file name
|
||||
sourceMapSourceRoot: string; // Source map's sourceRoot field - location where the sources will be present if not ""
|
||||
sourceMapSources: string[]; // Source map's sources field - list of sources that can be indexed in this source map
|
||||
sourceMapSourcesContent?: string[]; // Source map's sourcesContent field - list of the sources' text to be embedded in the source map
|
||||
inputSourceFileNames: string[]; // Input source file (which one can use on program to get the file), 1:1 mapping with the sourceMapSources list
|
||||
sourceMapNames?: string[]; // Source map's names field - list of names that can be indexed in this source map
|
||||
sourceMapMappings: string; // Source map's mapping field - encoded source map spans
|
||||
sourceMapDecodedMappings: SourceMapSpan[]; // Raw source map spans that were encoded into the sourceMapMappings
|
||||
}
|
||||
|
||||
@@ -1273,6 +1280,7 @@ module ts {
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
resolvesToSomeValue(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
getReferencedValueDeclaration(reference: Identifier): Declaration;
|
||||
serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
|
||||
serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
|
||||
serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
|
||||
@@ -1485,6 +1493,13 @@ module ts {
|
||||
// Class and interface types (TypeFlags.Class and TypeFlags.Interface)
|
||||
export interface InterfaceType extends ObjectType {
|
||||
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
|
||||
}
|
||||
|
||||
export interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
|
||||
export interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
|
||||
declaredProperties: Symbol[]; // Declared members
|
||||
declaredCallSignatures: Signature[]; // Declared call signatures
|
||||
declaredConstructSignatures: Signature[]; // Declared construct signatures
|
||||
@@ -1492,10 +1507,6 @@ module ts {
|
||||
declaredNumberIndexType: Type; // Declared numeric index type
|
||||
}
|
||||
|
||||
export interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
|
||||
// Type references (TypeFlags.Reference)
|
||||
export interface TypeReference extends ObjectType {
|
||||
target: GenericType; // Type reference target
|
||||
@@ -1639,11 +1650,15 @@ module ts {
|
||||
diagnostics?: boolean;
|
||||
emitBOM?: boolean;
|
||||
help?: boolean;
|
||||
inlineSourceMap?: boolean;
|
||||
inlineSources?: boolean;
|
||||
listFiles?: boolean;
|
||||
locale?: string;
|
||||
mapRoot?: string;
|
||||
module?: ModuleKind;
|
||||
newLine?: NewLineKind;
|
||||
noEmit?: boolean;
|
||||
noEmitHelpers?: boolean;
|
||||
noEmitOnError?: boolean;
|
||||
noErrorTruncation?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
@@ -1671,8 +1686,15 @@ module ts {
|
||||
None = 0,
|
||||
CommonJS = 1,
|
||||
AMD = 2,
|
||||
UMD = 3,
|
||||
System = 4,
|
||||
}
|
||||
|
||||
export const enum NewLineKind {
|
||||
CarriageReturnLineFeed = 0,
|
||||
LineFeed = 1,
|
||||
}
|
||||
|
||||
export interface LineAndCharacter {
|
||||
line: number;
|
||||
/*
|
||||
|
||||
+89
-10
@@ -775,7 +775,7 @@ module ts {
|
||||
let forStatement = <ForStatement>parent;
|
||||
return (forStatement.initializer === node && forStatement.initializer.kind !== SyntaxKind.VariableDeclarationList) ||
|
||||
forStatement.condition === node ||
|
||||
forStatement.iterator === node;
|
||||
forStatement.incrementor === node;
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.ForOfStatement:
|
||||
let forInStatement = <ForInStatement | ForOfStatement>parent;
|
||||
@@ -856,7 +856,7 @@ module ts {
|
||||
}
|
||||
|
||||
export function hasRestParameters(s: SignatureDeclaration): boolean {
|
||||
return s.parameters.length > 0 && s.parameters[s.parameters.length - 1].dotDotDotToken !== undefined;
|
||||
return s.parameters.length > 0 && lastOrUndefined(s.parameters).dotDotDotToken !== undefined;
|
||||
}
|
||||
|
||||
export function isLiteralKind(kind: SyntaxKind): boolean {
|
||||
@@ -1362,7 +1362,7 @@ module ts {
|
||||
let lineStartsOfS = computeLineStarts(s);
|
||||
if (lineStartsOfS.length > 1) {
|
||||
lineCount = lineCount + lineStartsOfS.length - 1;
|
||||
linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1];
|
||||
linePos = output.length - s.length + lastOrUndefined(lineStartsOfS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1435,8 +1435,10 @@ module ts {
|
||||
|
||||
export function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean {
|
||||
if (!isDeclarationFile(sourceFile)) {
|
||||
if ((isExternalModule(sourceFile) || !compilerOptions.out) && !fileExtensionIs(sourceFile.fileName, ".js")) {
|
||||
return true;
|
||||
if ((isExternalModule(sourceFile) || !compilerOptions.out)) {
|
||||
// 1. in-browser single file compilation scenario
|
||||
// 2. non .js file
|
||||
return compilerOptions.separateCompilation || !fileExtensionIs(sourceFile.fileName, ".js");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1671,16 +1673,16 @@ module ts {
|
||||
|
||||
// Returns false if this heritage clause element's expression contains something unsupported
|
||||
// (i.e. not a name or dotted name).
|
||||
export function isSupportedHeritageClauseElement(node: HeritageClauseElement): boolean {
|
||||
return isSupportedHeritageClauseElementExpression(node.expression);
|
||||
export function isSupportedExpressionWithTypeArguments(node: ExpressionWithTypeArguments): boolean {
|
||||
return isSupportedExpressionWithTypeArgumentsRest(node.expression);
|
||||
}
|
||||
|
||||
function isSupportedHeritageClauseElementExpression(node: Expression): boolean {
|
||||
function isSupportedExpressionWithTypeArgumentsRest(node: Expression): boolean {
|
||||
if (node.kind === SyntaxKind.Identifier) {
|
||||
return true;
|
||||
}
|
||||
else if (node.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
return isSupportedHeritageClauseElementExpression((<PropertyAccessExpression>node).expression);
|
||||
return isSupportedExpressionWithTypeArgumentsRest((<PropertyAccessExpression>node).expression);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
@@ -1693,7 +1695,84 @@ module ts {
|
||||
}
|
||||
|
||||
export function getLocalSymbolForExportDefault(symbol: Symbol) {
|
||||
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
|
||||
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace each instance of non-ascii characters by one, two, three, or four escape sequences
|
||||
* representing the UTF-8 encoding of the character, and return the expanded char code list.
|
||||
*/
|
||||
function getExpandedCharCodes(input: string): number[] {
|
||||
let output: number[] = [];
|
||||
let length = input.length;
|
||||
let leadSurrogate: number = undefined;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
let charCode = input.charCodeAt(i);
|
||||
|
||||
// handel utf8
|
||||
if (charCode < 0x80) {
|
||||
output.push(charCode);
|
||||
}
|
||||
else if (charCode < 0x800) {
|
||||
output.push((charCode >> 6) | 0B11000000);
|
||||
output.push((charCode & 0B00111111) | 0B10000000);
|
||||
}
|
||||
else if (charCode < 0x10000) {
|
||||
output.push((charCode >> 12) | 0B11100000);
|
||||
output.push(((charCode >> 6) & 0B00111111) | 0B10000000);
|
||||
output.push((charCode & 0B00111111) | 0B10000000);
|
||||
}
|
||||
else if (charCode < 0x20000) {
|
||||
output.push((charCode >> 18) | 0B11110000);
|
||||
output.push(((charCode >> 12) & 0B00111111) | 0B10000000);
|
||||
output.push(((charCode >> 6) & 0B00111111) | 0B10000000);
|
||||
output.push((charCode & 0B00111111) | 0B10000000);
|
||||
}
|
||||
else {
|
||||
Debug.assert(false, "Unexpected code point");
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
const base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
|
||||
/**
|
||||
* Converts a string to a base-64 encoded ASCII string.
|
||||
*/
|
||||
export function convertToBase64(input: string): string {
|
||||
var result = "";
|
||||
let charCodes = getExpandedCharCodes(input);
|
||||
let i = 0;
|
||||
let length = charCodes.length;
|
||||
let byte1: number, byte2: number, byte3: number, byte4: number;
|
||||
|
||||
while (i < length) {
|
||||
// Convert every 6-bits in the input 3 character points
|
||||
// into a base64 digit
|
||||
byte1 = charCodes[i] >> 2;
|
||||
byte2 = (charCodes[i] & 0B00000011) << 4 | charCodes[i + 1] >> 4;
|
||||
byte3 = (charCodes[i + 1] & 0B00001111) << 2 | charCodes[i + 2] >> 6;
|
||||
byte4 = charCodes[i + 2] & 0B00111111;
|
||||
|
||||
// We are out of characters in the input, set the extra
|
||||
// digits to 64 (padding character).
|
||||
if (i + 1 >= length) {
|
||||
byte3 = byte4 = 64;
|
||||
}
|
||||
else if (i + 2 >= length) {
|
||||
byte4 = 64;
|
||||
}
|
||||
|
||||
// Write to the ouput
|
||||
result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4);
|
||||
|
||||
i += 3;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
program = _program;
|
||||
}, function (settings) {
|
||||
harnessCompiler.setCompilerSettings(tcSettings);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -159,7 +159,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
|
||||
// Source maps?
|
||||
it('Correct sourcemap content for ' + fileName, () => {
|
||||
if (options.sourceMap) {
|
||||
if (options.sourceMap || options.inlineSourceMap) {
|
||||
Harness.Baseline.runBaseline('Correct sourcemap content for ' + fileName, justName.replace(/\.ts$/, '.sourcemap.txt'), () => {
|
||||
var record = result.getSourceMapRecord();
|
||||
if (options.noEmitOnError && result.errors.length !== 0 && record === undefined) {
|
||||
@@ -228,7 +228,13 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
});
|
||||
|
||||
it('Correct Sourcemap output for ' + fileName, () => {
|
||||
if (options.sourceMap) {
|
||||
if (options.inlineSourceMap) {
|
||||
if (result.sourceMaps.length > 0) {
|
||||
throw new Error('No sourcemap files should be generated if inlineSourceMaps was set.');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else if (options.sourceMap) {
|
||||
if (result.sourceMaps.length !== result.files.length) {
|
||||
throw new Error('Number of sourcemap files should be same as js files.');
|
||||
}
|
||||
@@ -252,7 +258,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
}
|
||||
});
|
||||
|
||||
it('Correct type baselines for ' + fileName, () => {
|
||||
it('Correct type/symbol baselines for ' + fileName, () => {
|
||||
if (fileName.indexOf("APISample") >= 0) {
|
||||
return;
|
||||
}
|
||||
@@ -289,8 +295,26 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
|
||||
// Produce baselines. The first gives the types for all expressions.
|
||||
// The second gives symbols for all identifiers.
|
||||
checkBaseLines(/*isSymbolBaseLine:*/ false);
|
||||
checkBaseLines(/*isSymbolBaseLine:*/ true);
|
||||
var e1: Error, e2: Error;
|
||||
try {
|
||||
checkBaseLines(/*isSymbolBaseLine:*/ false);
|
||||
}
|
||||
catch (e) {
|
||||
e1 = e;
|
||||
}
|
||||
|
||||
try {
|
||||
checkBaseLines(/*isSymbolBaseLine:*/ true);
|
||||
}
|
||||
catch (e) {
|
||||
e2 = e;
|
||||
}
|
||||
|
||||
if (e1 || e2) {
|
||||
throw e1 || e2;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
function checkBaseLines(isSymbolBaseLine: boolean) {
|
||||
let fullBaseLine = generateBaseLine(fullResults, isSymbolBaseLine);
|
||||
|
||||
+67
-11
@@ -1570,6 +1570,28 @@ module FourSlash {
|
||||
this.currentCaretPosition = definition.textSpan.start;
|
||||
}
|
||||
|
||||
public goToTypeDefinition(definitionIndex: number) {
|
||||
if (definitionIndex === 0) {
|
||||
this.scenarioActions.push('<GoToTypeDefinition />');
|
||||
}
|
||||
else {
|
||||
this.taoInvalidReason = 'GoToTypeDefinition not supported for non-zero definition indices';
|
||||
}
|
||||
|
||||
var definitions = this.languageService.getTypeDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
if (!definitions || !definitions.length) {
|
||||
this.raiseError('goToTypeDefinition failed - expected to at least one definition location but got 0');
|
||||
}
|
||||
|
||||
if (definitionIndex >= definitions.length) {
|
||||
this.raiseError('goToTypeDefinition failed - definitionIndex value (' + definitionIndex + ') exceeds definition list size (' + definitions.length + ')');
|
||||
}
|
||||
|
||||
var definition = definitions[definitionIndex];
|
||||
this.openFile(definition.fileName);
|
||||
this.currentCaretPosition = definition.textSpan.start;
|
||||
}
|
||||
|
||||
public verifyDefinitionLocationExists(negative: boolean) {
|
||||
this.taoInvalidReason = 'verifyDefinitionLocationExists NYI';
|
||||
|
||||
@@ -1589,8 +1611,18 @@ module FourSlash {
|
||||
var assertFn = negative ? assert.notEqual : assert.equal;
|
||||
|
||||
var definitions = this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
var actualCount = definitions && definitions.length || 0;
|
||||
|
||||
assertFn(definitions.length, expectedCount, this.messageAtLastKnownMarker("Definitions Count"));
|
||||
assertFn(actualCount, expectedCount, this.messageAtLastKnownMarker("Definitions Count"));
|
||||
}
|
||||
|
||||
public verifyTypeDefinitionsCount(negative: boolean, expectedCount: number) {
|
||||
var assertFn = negative ? assert.notEqual : assert.equal;
|
||||
|
||||
var definitions = this.languageService.getTypeDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
var actualCount = definitions && definitions.length || 0;
|
||||
|
||||
assertFn(actualCount, expectedCount, this.messageAtLastKnownMarker("Type definitions Count"));
|
||||
}
|
||||
|
||||
public verifyDefinitionsName(negative: boolean, expectedName: string, expectedContainerName: string) {
|
||||
@@ -2192,38 +2224,62 @@ module FourSlash {
|
||||
xmlData.push(xml);
|
||||
}
|
||||
|
||||
// We don't want to recompile 'fourslash.ts' for every test, so
|
||||
// here we cache the JS output and reuse it for every test.
|
||||
let fourslashJsOutput: string;
|
||||
{
|
||||
let host = Harness.Compiler.createCompilerHost([{ unitName: Harness.Compiler.fourslashFileName, content: undefined }],
|
||||
(fn, contents) => fourslashJsOutput = contents,
|
||||
ts.ScriptTarget.Latest,
|
||||
ts.sys.useCaseSensitiveFileNames);
|
||||
|
||||
let program = ts.createProgram([Harness.Compiler.fourslashFileName], { noResolve: true, target: ts.ScriptTarget.ES3 }, host);
|
||||
|
||||
program.emit(host.getSourceFile(Harness.Compiler.fourslashFileName, ts.ScriptTarget.ES3));
|
||||
}
|
||||
|
||||
|
||||
export function runFourSlashTestContent(basePath: string, testType: FourSlashTestType, content: string, fileName: string): TestXmlData {
|
||||
// Parse out the files and their metadata
|
||||
var testData = parseTestData(basePath, content, fileName);
|
||||
let testData = parseTestData(basePath, content, fileName);
|
||||
|
||||
currentTestState = new TestState(basePath, testType, testData);
|
||||
|
||||
var result = '';
|
||||
var host = Harness.Compiler.createCompilerHost([{ unitName: Harness.Compiler.fourslashFileName, content: undefined },
|
||||
{ unitName: fileName, content: content }],
|
||||
let result = '';
|
||||
let host = Harness.Compiler.createCompilerHost(
|
||||
[
|
||||
{ unitName: Harness.Compiler.fourslashFileName, content: undefined },
|
||||
{ unitName: fileName, content: content }
|
||||
],
|
||||
(fn, contents) => result = contents,
|
||||
ts.ScriptTarget.Latest,
|
||||
ts.sys.useCaseSensitiveFileNames);
|
||||
// TODO (drosen): We need to enforce checking on these tests.
|
||||
var program = ts.createProgram([Harness.Compiler.fourslashFileName, fileName], { out: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host);
|
||||
|
||||
var diagnostics = ts.getPreEmitDiagnostics(program);
|
||||
let program = ts.createProgram([Harness.Compiler.fourslashFileName, fileName], { out: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host);
|
||||
|
||||
let sourceFile = host.getSourceFile(fileName, ts.ScriptTarget.ES3);
|
||||
|
||||
let diagnostics = ts.getPreEmitDiagnostics(program, sourceFile);
|
||||
if (diagnostics.length > 0) {
|
||||
throw new Error('Error compiling ' + fileName + ': ' +
|
||||
diagnostics.map(e => ts.flattenDiagnosticMessageText(e.messageText, ts.sys.newLine)).join('\r\n'));
|
||||
}
|
||||
program.emit();
|
||||
|
||||
program.emit(sourceFile);
|
||||
result = result || ''; // Might have an empty fourslash file
|
||||
|
||||
result = fourslashJsOutput + "\r\n" + result;
|
||||
|
||||
// Compile and execute the test
|
||||
try {
|
||||
eval(result);
|
||||
} catch (err) {
|
||||
}
|
||||
catch (err) {
|
||||
// Debugging: FourSlash.currentTestState.printCurrentFileState();
|
||||
throw err;
|
||||
}
|
||||
|
||||
var xmlData = currentTestState.getTestXmlData();
|
||||
let xmlData = currentTestState.getTestXmlData();
|
||||
xmlData.originalName = fileName;
|
||||
return xmlData;
|
||||
}
|
||||
|
||||
+56
-19
@@ -45,10 +45,10 @@ module Utils {
|
||||
export function getExecutionEnvironment() {
|
||||
if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") {
|
||||
return ExecutionEnvironment.CScript;
|
||||
} else if (process && process.execPath && process.execPath.indexOf("node") !== -1) {
|
||||
return ExecutionEnvironment.Node;
|
||||
} else {
|
||||
} else if (typeof window !== "undefined") {
|
||||
return ExecutionEnvironment.Browser;
|
||||
} else {
|
||||
return ExecutionEnvironment.Node;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -805,6 +805,9 @@ module Harness {
|
||||
return result;
|
||||
}
|
||||
|
||||
const carriageReturnLineFeed = "\r\n";
|
||||
const lineFeed = "\n";
|
||||
|
||||
export var defaultLibFileName = 'lib.d.ts';
|
||||
export var defaultLibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest);
|
||||
export var defaultES6LibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.es6.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest);
|
||||
@@ -822,7 +825,8 @@ module Harness {
|
||||
scriptTarget: ts.ScriptTarget,
|
||||
useCaseSensitiveFileNames: boolean,
|
||||
// the currentDirectory is needed for rwcRunner to passed in specified current directory to compiler host
|
||||
currentDirectory?: string): ts.CompilerHost {
|
||||
currentDirectory?: string,
|
||||
newLineKind?: ts.NewLineKind): ts.CompilerHost {
|
||||
|
||||
// Local get canonical file name function, that depends on passed in parameter for useCaseSensitiveFileNames
|
||||
function getCanonicalFileName(fileName: string): string {
|
||||
@@ -841,6 +845,11 @@ module Harness {
|
||||
};
|
||||
inputFiles.forEach(register);
|
||||
|
||||
let newLine =
|
||||
newLineKind === ts.NewLineKind.CarriageReturnLineFeed ? carriageReturnLineFeed :
|
||||
newLineKind === ts.NewLineKind.LineFeed ? lineFeed :
|
||||
ts.sys.newLine;
|
||||
|
||||
return {
|
||||
getCurrentDirectory,
|
||||
getSourceFile: (fn, languageVersion) => {
|
||||
@@ -869,7 +878,7 @@ module Harness {
|
||||
writeFile,
|
||||
getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
|
||||
getNewLine: () => ts.sys.newLine
|
||||
getNewLine: () => newLine
|
||||
};
|
||||
}
|
||||
|
||||
@@ -957,8 +966,12 @@ module Harness {
|
||||
if (typeof setting.value === 'string') {
|
||||
if (setting.value.toLowerCase() === 'amd') {
|
||||
options.module = ts.ModuleKind.AMD;
|
||||
} else if (setting.value.toLowerCase() === 'umd') {
|
||||
options.module = ts.ModuleKind.UMD;
|
||||
} else if (setting.value.toLowerCase() === 'commonjs') {
|
||||
options.module = ts.ModuleKind.CommonJS;
|
||||
} else if (setting.value.toLowerCase() === 'system') {
|
||||
options.module = ts.ModuleKind.System;
|
||||
} else if (setting.value.toLowerCase() === 'unspecified') {
|
||||
options.module = ts.ModuleKind.None;
|
||||
} else {
|
||||
@@ -986,6 +999,14 @@ module Harness {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'emitdecoratormetadata':
|
||||
options.emitDecoratorMetadata = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'noemithelpers':
|
||||
options.noEmitHelpers = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'noemitonerror':
|
||||
options.noEmitOnError = !!setting.value;
|
||||
break;
|
||||
@@ -1016,6 +1037,10 @@ module Harness {
|
||||
options.sourceRoot = setting.value;
|
||||
break;
|
||||
|
||||
case 'maproot':
|
||||
options.mapRoot = setting.value;
|
||||
break;
|
||||
|
||||
case 'sourcemap':
|
||||
options.sourceMap = !!setting.value;
|
||||
break;
|
||||
@@ -1025,7 +1050,18 @@ module Harness {
|
||||
break;
|
||||
|
||||
case 'newline':
|
||||
case 'newlines':
|
||||
if (setting.value.toLowerCase() === 'crlf') {
|
||||
options.newLine = ts.NewLineKind.CarriageReturnLineFeed;
|
||||
}
|
||||
else if (setting.value.toLowerCase() === 'lf') {
|
||||
options.newLine = ts.NewLineKind.LineFeed;
|
||||
}
|
||||
else {
|
||||
throw new Error('Unknown option for newLine: ' + setting.value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'normalizenewline':
|
||||
newLine = setting.value;
|
||||
break;
|
||||
|
||||
@@ -1069,6 +1105,14 @@ module Harness {
|
||||
includeBuiltFiles.push({ unitName: builtFileName, content: normalizeLineEndings(IO.readFile(builtFileName), newLine) });
|
||||
break;
|
||||
|
||||
case 'inlinesourcemap':
|
||||
options.inlineSourceMap = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'inlinesources':
|
||||
options.inlineSources = setting.value === 'true';
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error('Unsupported compiler setting ' + setting.flag);
|
||||
}
|
||||
@@ -1079,7 +1123,7 @@ module Harness {
|
||||
var programFiles = inputFiles.concat(includeBuiltFiles).map(file => file.unitName);
|
||||
var program = ts.createProgram(programFiles, options, createCompilerHost(inputFiles.concat(includeBuiltFiles).concat(otherFiles),
|
||||
(fn, contents, writeByteOrderMark) => fileOutputs.push({ fileName: fn, code: contents, writeByteOrderMark: writeByteOrderMark }),
|
||||
options.target, useCaseSensitiveFileNames, currentDirectory));
|
||||
options.target, useCaseSensitiveFileNames, currentDirectory, options.newLine));
|
||||
|
||||
var emitResult = program.emit();
|
||||
|
||||
@@ -1461,11 +1505,12 @@ module Harness {
|
||||
|
||||
// List of allowed metadata names
|
||||
var fileMetadataNames = ["filename", "comments", "declaration", "module",
|
||||
"nolib", "sourcemap", "target", "out", "outdir", "noemitonerror",
|
||||
"noimplicitany", "noresolve", "newline", "newlines", "emitbom",
|
||||
"nolib", "sourcemap", "target", "out", "outdir", "noemithelpers", "noemitonerror",
|
||||
"noimplicitany", "noresolve", "newline", "normalizenewline", "emitbom",
|
||||
"errortruncation", "usecasesensitivefilenames", "preserveconstenums",
|
||||
"includebuiltfile", "suppressimplicitanyindexerrors", "stripinternal",
|
||||
"separatecompilation"];
|
||||
"separatecompilation", "inlinesourcemap", "maproot", "sourceroot",
|
||||
"inlinesources", "emitdecoratormetadata"];
|
||||
|
||||
function extractCompilerSettings(content: string): CompilerSetting[] {
|
||||
|
||||
@@ -1565,7 +1610,6 @@ module Harness {
|
||||
export module Baseline {
|
||||
|
||||
export interface BaselineOptions {
|
||||
LineEndingSensitive?: boolean;
|
||||
Subfolder?: string;
|
||||
Baselinefolder?: string;
|
||||
}
|
||||
@@ -1657,13 +1701,6 @@ module Harness {
|
||||
expected = IO.readFile(refFileName);
|
||||
}
|
||||
|
||||
var lineEndingSensitive = opts && opts.LineEndingSensitive;
|
||||
|
||||
if (!lineEndingSensitive) {
|
||||
expected = expected.replace(/\r\n?/g, '\n');
|
||||
actual = actual.replace(/\r\n?/g, '\n');
|
||||
}
|
||||
|
||||
return { expected, actual };
|
||||
}
|
||||
|
||||
@@ -1719,4 +1756,4 @@ module Harness {
|
||||
}
|
||||
|
||||
// TODO: not sure why Utils.evalFile isn't working with this, eventually will concat it like old compiler instead of eval
|
||||
eval(Harness.tcServicesFile);
|
||||
eval(Harness.tcServicesFile);
|
||||
|
||||
@@ -186,6 +186,7 @@ module Harness.LanguageService {
|
||||
var script = this.getScriptInfo(fileName);
|
||||
return script ? script.version.toString() : undefined;
|
||||
}
|
||||
|
||||
log(s: string): void { }
|
||||
trace(s: string): void { }
|
||||
error(s: string): void { }
|
||||
@@ -203,7 +204,7 @@ module Harness.LanguageService {
|
||||
}
|
||||
|
||||
/// Shim adapter
|
||||
class ShimLanguageServiceHost extends LanguageServiceAdapterHost implements ts.LanguageServiceShimHost {
|
||||
class ShimLanguageServiceHost extends LanguageServiceAdapterHost implements ts.LanguageServiceShimHost, ts.CoreServicesShimHost {
|
||||
private nativeHost: NativeLanguageServiceHost;
|
||||
constructor(cancellationToken?: ts.CancellationToken, options?: ts.CompilerOptions) {
|
||||
super(cancellationToken, options);
|
||||
@@ -227,6 +228,11 @@ module Harness.LanguageService {
|
||||
}
|
||||
getScriptVersion(fileName: string): string { return this.nativeHost.getScriptVersion(fileName); }
|
||||
getLocalizedDiagnosticMessages(): string { return JSON.stringify({}); }
|
||||
|
||||
readDirectory(rootDir: string, extension: string): string {
|
||||
throw new Error("NYI");
|
||||
}
|
||||
|
||||
log(s: string): void { this.nativeHost.log(s); }
|
||||
trace(s: string): void { this.nativeHost.trace(s); }
|
||||
error(s: string): void { this.nativeHost.error(s); }
|
||||
@@ -336,6 +342,9 @@ module Harness.LanguageService {
|
||||
getDefinitionAtPosition(fileName: string, position: number): ts.DefinitionInfo[] {
|
||||
return unwrapJSONCallResult(this.shim.getDefinitionAtPosition(fileName, position));
|
||||
}
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): ts.DefinitionInfo[]{
|
||||
return unwrapJSONCallResult(this.shim.getTypeDefinitionAtPosition(fileName, position));
|
||||
}
|
||||
getReferencesAtPosition(fileName: string, position: number): ts.ReferenceEntry[] {
|
||||
return unwrapJSONCallResult(this.shim.getReferencesAtPosition(fileName, position));
|
||||
}
|
||||
|
||||
@@ -328,8 +328,10 @@ class ProjectRunner extends RunnerBase {
|
||||
return Harness.Compiler.getErrorBaseline(inputFiles, diagnostics);
|
||||
}
|
||||
|
||||
describe('Compiling project for ' + testCase.scenario + ': testcase ' + testCaseFileName, () => {
|
||||
function verifyCompilerResults(compilerResult: BatchCompileProjectTestCaseResult) {
|
||||
var name = 'Compiling project for ' + testCase.scenario + ': testcase ' + testCaseFileName;
|
||||
|
||||
describe(name, () => {
|
||||
function verifyCompilerResults(moduleKind: ts.ModuleKind) {
|
||||
function getCompilerResolutionInfo() {
|
||||
var resolutionInfo: ProjectRunnerTestCaseResolutionInfo = {
|
||||
scenario: testCase.scenario,
|
||||
@@ -354,23 +356,33 @@ class ProjectRunner extends RunnerBase {
|
||||
return resolutionInfo;
|
||||
}
|
||||
|
||||
it('Resolution information of (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, () => {
|
||||
var compilerResult: BatchCompileProjectTestCaseResult;
|
||||
|
||||
it(name + ": " + moduleNameToString(moduleKind) , () => {
|
||||
// Compile using node
|
||||
compilerResult = batchCompilerProjectTestCase(moduleKind);
|
||||
});
|
||||
|
||||
it('Resolution information of (' + moduleNameToString(moduleKind) + '): ' + testCaseFileName, () => {
|
||||
Harness.Baseline.runBaseline('Resolution information of (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.json', () => {
|
||||
return JSON.stringify(getCompilerResolutionInfo(), undefined, " ");
|
||||
});
|
||||
});
|
||||
|
||||
if (compilerResult.errors.length) {
|
||||
it('Errors for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, () => {
|
||||
|
||||
it('Errors for (' + moduleNameToString(moduleKind) + '): ' + testCaseFileName, () => {
|
||||
if (compilerResult.errors.length) {
|
||||
Harness.Baseline.runBaseline('Errors for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.errors.txt', () => {
|
||||
return getErrorsBaseline(compilerResult);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
it('Baseline of emitted result (' + moduleNameToString(moduleKind) + '): ' + testCaseFileName, () => {
|
||||
if (testCase.baselineCheck) {
|
||||
ts.forEach(compilerResult.outputFiles, outputFile => {
|
||||
|
||||
if (testCase.baselineCheck) {
|
||||
ts.forEach(compilerResult.outputFiles, outputFile => {
|
||||
it('Baseline of emitted result (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, () => {
|
||||
Harness.Baseline.runBaseline('Baseline of emitted result (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + outputFile.fileName, () => {
|
||||
try {
|
||||
return ts.sys.readFile(getProjectOutputFolder(outputFile.fileName, compilerResult.moduleKind));
|
||||
@@ -380,76 +392,42 @@ class ProjectRunner extends RunnerBase {
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
it('SourceMapRecord for (' + moduleNameToString(moduleKind) + '): ' + testCaseFileName, () => {
|
||||
if (compilerResult.sourceMapData) {
|
||||
it('SourceMapRecord for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, () => {
|
||||
Harness.Baseline.runBaseline('SourceMapRecord for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.sourcemap.txt', () => {
|
||||
return Harness.SourceMapRecoder.getSourceMapRecord(compilerResult.sourceMapData, compilerResult.program,
|
||||
ts.filter(compilerResult.outputFiles, outputFile => Harness.Compiler.isJS(outputFile.emittedFileName)));
|
||||
});
|
||||
Harness.Baseline.runBaseline('SourceMapRecord for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.sourcemap.txt', () => {
|
||||
return Harness.SourceMapRecoder.getSourceMapRecord(compilerResult.sourceMapData, compilerResult.program,
|
||||
ts.filter(compilerResult.outputFiles, outputFile => Harness.Compiler.isJS(outputFile.emittedFileName)));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Verify that all the generated .d.ts files compile
|
||||
// Verify that all the generated .d.ts files compile
|
||||
|
||||
it('Errors in generated Dts files for (' + moduleNameToString(moduleKind) + '): ' + testCaseFileName, () => {
|
||||
if (!compilerResult.errors.length && testCase.declaration) {
|
||||
var dTsCompileResult = compileCompileDTsFiles(compilerResult);
|
||||
if (dTsCompileResult.errors.length) {
|
||||
it('Errors in generated Dts files for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, () => {
|
||||
Harness.Baseline.runBaseline('Errors in generated Dts files for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.dts.errors.txt', () => {
|
||||
return getErrorsBaseline(dTsCompileResult);
|
||||
});
|
||||
Harness.Baseline.runBaseline('Errors in generated Dts files for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.dts.errors.txt', () => {
|
||||
return getErrorsBaseline(dTsCompileResult);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
after(() => {
|
||||
compilerResult = undefined;
|
||||
});
|
||||
}
|
||||
|
||||
// Compile using node
|
||||
var nodeCompilerResult = batchCompilerProjectTestCase(ts.ModuleKind.CommonJS);
|
||||
verifyCompilerResults(nodeCompilerResult);
|
||||
|
||||
// Compile using amd
|
||||
var amdCompilerResult = batchCompilerProjectTestCase(ts.ModuleKind.AMD);
|
||||
verifyCompilerResults(amdCompilerResult);
|
||||
|
||||
if (testCase.runTest) {
|
||||
//TODO(ryanca/danquirk): Either support this or remove this option from the interface as well as test case json files
|
||||
// Node results
|
||||
assert.isTrue(!nodeCompilerResult.nonSubfolderDiskFiles, "Cant run test case that generates parent folders/absolute path");
|
||||
//it("runs without error: (" + moduleNameToString(nodeCompilerResult.moduleKind) + ')', function (done: any) {
|
||||
// Exec.exec("node.exe", ['"' + baseLineLocalPath(nodeCompilerResult.outputFiles[0].diskRelativeName, nodeCompilerResult.moduleKind) + '"'], function (res) {
|
||||
// Harness.Assert.equal(res.stdout, "");
|
||||
// Harness.Assert.equal(res.stderr, "");
|
||||
// done();
|
||||
// })
|
||||
//});
|
||||
|
||||
// Amd results
|
||||
assert.isTrue(!amdCompilerResult.nonSubfolderDiskFiles, "Cant run test case that generates parent folders/absolute path");
|
||||
//var amdDriverTemplate = "var requirejs = require('../r.js');\n\n" +
|
||||
// "requirejs.config({\n" +
|
||||
// " nodeRequire: require\n" +
|
||||
// "});\n\n" +
|
||||
// "requirejs(['{0}'],\n" +
|
||||
// "function ({0}) {\n" +
|
||||
// "});";
|
||||
//var moduleName = baseLineLocalPath(amdCompilerResult.outputFiles[0].diskRelativeName, amdCompilerResult.moduleKind).replace(/\.js$/, "");
|
||||
//sys.writeFile(testCase.projectRoot + '/driver.js', amdDriverTemplate.replace(/\{0}/g, moduleName));
|
||||
//it("runs without error (" + moduleNameToString(amdCompilerResult.moduleKind) + ')', function (done: any) {
|
||||
// Exec.exec("node.exe", ['"' + testCase.projectRoot + '/driver.js"'], function (res) {
|
||||
// Harness.Assert.equal(res.stdout, "");
|
||||
// Harness.Assert.equal(res.stderr, "");
|
||||
// done();
|
||||
// })
|
||||
//});
|
||||
}
|
||||
verifyCompilerResults(ts.ModuleKind.CommonJS);
|
||||
verifyCompilerResults(ts.ModuleKind.AMD);
|
||||
|
||||
after(() => {
|
||||
// Mocha holds onto the closure environment of the describe callback even after the test is done.
|
||||
// Therefore we have to clean out large objects after the test is done.
|
||||
nodeCompilerResult = undefined;
|
||||
amdCompilerResult = undefined;
|
||||
testCase = undefined;
|
||||
testFileText = undefined;
|
||||
testCaseJustName = undefined;
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
/// <reference path='rwcRunner.ts' />
|
||||
|
||||
function runTests(runners: RunnerBase[]) {
|
||||
if (reverse) {
|
||||
runners = runners.reverse();
|
||||
}
|
||||
for (var i = iterations; i > 0; i--) {
|
||||
for (var j = 0; j < runners.length; j++) {
|
||||
runners[j].initializeTests();
|
||||
@@ -31,8 +28,6 @@ function runTests(runners: RunnerBase[]) {
|
||||
}
|
||||
|
||||
var runners: RunnerBase[] = [];
|
||||
global.runners = runners;
|
||||
var reverse: boolean = false;
|
||||
var iterations: number = 1;
|
||||
|
||||
// users can define tests to run in mytest.config that will override cmd line args, otherwise use cmd line args (test.config), otherwise no options
|
||||
@@ -78,9 +73,6 @@ if (testConfigFile !== '') {
|
||||
case 'test262':
|
||||
runners.push(new Test262BaselineRunner());
|
||||
break;
|
||||
case 'reverse':
|
||||
reverse = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,6 +237,9 @@ module Harness.SourceMapRecoder {
|
||||
sourceMapRecoder.WriteLine("mapUrl: " + sourceMapData.jsSourceMappingURL);
|
||||
sourceMapRecoder.WriteLine("sourceRoot: " + sourceMapData.sourceMapSourceRoot);
|
||||
sourceMapRecoder.WriteLine("sources: " + sourceMapData.sourceMapSources);
|
||||
if (sourceMapData.sourceMapSourcesContent) {
|
||||
sourceMapRecoder.WriteLine("sourcesContent: " + JSON.stringify(sourceMapData.sourceMapSourcesContent));
|
||||
}
|
||||
sourceMapRecoder.WriteLine("===================================================================");
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -546,7 +546,7 @@ interface Math {
|
||||
*/
|
||||
atan(x: number): number;
|
||||
/**
|
||||
* Returns the angle (in radians) from the X axis to a point (y,x).
|
||||
* Returns the angle (in radians) from the X axis to a point.
|
||||
* @param y A numeric expression representing the cartesian y-coordinate.
|
||||
* @param x A numeric expression representing the cartesian x-coordinate.
|
||||
*/
|
||||
|
||||
Vendored
+11
@@ -3697,6 +3697,8 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.
|
||||
* @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl");
|
||||
*/
|
||||
getContext(contextId: "2d"): CanvasRenderingContext2D;
|
||||
getContext(contextId: "experimental-webgl"): WebGLRenderingContext;
|
||||
getContext(contextId: string, ...args: any[]): CanvasRenderingContext2D | WebGLRenderingContext;
|
||||
/**
|
||||
* Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing.
|
||||
@@ -12178,6 +12180,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
overrideMimeType(mime: string): void;
|
||||
send(data?: Document): void;
|
||||
send(data?: string): void;
|
||||
send(data?: any): void;
|
||||
setRequestHeader(header: string, value: string): void;
|
||||
DONE: number;
|
||||
HEADERS_RECEIVED: number;
|
||||
@@ -12332,11 +12335,13 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"CloseEvent"): CloseEvent;
|
||||
createEvent(eventInterface:"CommandEvent"): CommandEvent;
|
||||
createEvent(eventInterface:"CompositionEvent"): CompositionEvent;
|
||||
createEvent(eventInterface: "CustomEvent"): CustomEvent;
|
||||
createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent;
|
||||
createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent;
|
||||
createEvent(eventInterface:"DragEvent"): DragEvent;
|
||||
createEvent(eventInterface:"ErrorEvent"): ErrorEvent;
|
||||
createEvent(eventInterface:"Event"): Event;
|
||||
createEvent(eventInterface:"Events"): Event;
|
||||
createEvent(eventInterface:"FocusEvent"): FocusEvent;
|
||||
createEvent(eventInterface:"GamepadEvent"): GamepadEvent;
|
||||
createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent;
|
||||
@@ -12351,8 +12356,12 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent;
|
||||
createEvent(eventInterface:"MessageEvent"): MessageEvent;
|
||||
createEvent(eventInterface:"MouseEvent"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseEvents"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent;
|
||||
createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent;
|
||||
createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent;
|
||||
createEvent(eventInterface:"MutationEvent"): MutationEvent;
|
||||
createEvent(eventInterface:"MutationEvents"): MutationEvent;
|
||||
createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent;
|
||||
createEvent(eventInterface:"NavigationEvent"): NavigationEvent;
|
||||
createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer;
|
||||
@@ -12363,6 +12372,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"PopStateEvent"): PopStateEvent;
|
||||
createEvent(eventInterface:"ProgressEvent"): ProgressEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent;
|
||||
createEvent(eventInterface:"StorageEvent"): StorageEvent;
|
||||
createEvent(eventInterface:"TextEvent"): TextEvent;
|
||||
@@ -12370,6 +12380,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"TrackEvent"): TrackEvent;
|
||||
createEvent(eventInterface:"TransitionEvent"): TransitionEvent;
|
||||
createEvent(eventInterface:"UIEvent"): UIEvent;
|
||||
createEvent(eventInterface:"UIEvents"): UIEvent;
|
||||
createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent;
|
||||
createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent;
|
||||
createEvent(eventInterface:"WheelEvent"): WheelEvent;
|
||||
|
||||
Vendored
+53
-19
@@ -51,11 +51,41 @@ interface SymbolConstructor {
|
||||
isConcatSpreadable: symbol;
|
||||
|
||||
/**
|
||||
* A method that returns the default iterator for an object.Called by the semantics of the
|
||||
* A method that returns the default iterator for an object. Called by the semantics of the
|
||||
* for-of statement.
|
||||
*/
|
||||
iterator: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that matches the regular expression against a string. Called
|
||||
* by the String.prototype.match method.
|
||||
*/
|
||||
match: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that replaces matched substrings of a string. Called by the
|
||||
* String.prototype.replace method.
|
||||
*/
|
||||
replace: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that returns the index within a string that matches the
|
||||
* regular expression. Called by the String.prototype.search method.
|
||||
*/
|
||||
search: symbol;
|
||||
|
||||
/**
|
||||
* A function valued property that is the constructor function that is used to create
|
||||
* derived objects.
|
||||
*/
|
||||
species: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that splits a string at the indices that match the regular
|
||||
* expression. Called by the String.prototype.split method.
|
||||
*/
|
||||
split: symbol;
|
||||
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
|
||||
* abstract operation.
|
||||
@@ -442,7 +472,7 @@ interface IteratorResult<T> {
|
||||
}
|
||||
|
||||
interface Iterator<T> {
|
||||
next(): IteratorResult<T>;
|
||||
next(value?: any): IteratorResult<T>;
|
||||
return?(value?: any): IteratorResult<T>;
|
||||
throw?(e?: any): IteratorResult<T>;
|
||||
}
|
||||
@@ -3542,6 +3572,16 @@ declare module Reflect {
|
||||
function setPrototypeOf(target: any, proto: any): boolean;
|
||||
}
|
||||
|
||||
interface PromiseLike<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the completion of an asynchronous operation
|
||||
*/
|
||||
@@ -3552,14 +3592,16 @@ interface Promise<T> {
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | Promise<TResult>, onrejected?: (reason: any) => TResult | Promise<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch(onrejected?: (reason: any) => T | Promise<T>): Promise<T>;
|
||||
catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
[Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
@@ -3570,13 +3612,11 @@ interface PromiseConstructor {
|
||||
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param init A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
<T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
@@ -3584,15 +3624,7 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of values.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all(values: Promise<void>[]): Promise<void>;
|
||||
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
@@ -3600,7 +3632,7 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T>(values: (T | Promise<T>)[]): Promise<T>;
|
||||
race<T>(values: Iterable<T | PromiseLike<T>>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
@@ -3621,13 +3653,15 @@ interface PromiseConstructor {
|
||||
* @param value A promise.
|
||||
* @returns A promise whose internal state matches the provided promise.
|
||||
*/
|
||||
resolve<T>(value: T | Promise<T>): Promise<T>;
|
||||
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise .
|
||||
* @returns A resolved promise.
|
||||
*/
|
||||
resolve(): Promise<void>;
|
||||
|
||||
[Symbol.species]: Function;
|
||||
}
|
||||
|
||||
declare var Promise: PromiseConstructor;
|
||||
|
||||
Vendored
+133
@@ -45,6 +45,139 @@ interface ArrayBufferView {
|
||||
byteOffset: number;
|
||||
}
|
||||
|
||||
interface DataView {
|
||||
buffer: ArrayBuffer;
|
||||
byteLength: number;
|
||||
byteOffset: number;
|
||||
/**
|
||||
* Gets the Float32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getFloat32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Float64 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getFloat64(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Int8 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt8(byteOffset: number): number;
|
||||
|
||||
/**
|
||||
* Gets the Int16 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt16(byteOffset: number, littleEndian: boolean): number;
|
||||
/**
|
||||
* Gets the Int32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint8 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint8(byteOffset: number): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint16 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint16(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Stores an Float32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setFloat32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Float64 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setFloat64(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int8 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
setInt8(byteOffset: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Stores an Int16 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setInt16(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setInt32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint8 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
setUint8(byteOffset: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint16 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setUint16(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
}
|
||||
|
||||
interface DataViewConstructor {
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
|
||||
}
|
||||
declare var DataView: DataViewConstructor;
|
||||
|
||||
/**
|
||||
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
|
||||
@@ -300,6 +300,32 @@ module ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] {
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
|
||||
var args: protocol.FileLocationRequestArgs = {
|
||||
file: fileName,
|
||||
line: lineOffset.line,
|
||||
offset: lineOffset.offset,
|
||||
};
|
||||
|
||||
var request = this.processRequest<protocol.TypeDefinitionRequest>(CommandNames.TypeDefinition, args);
|
||||
var response = this.processResponse<protocol.TypeDefinitionResponse>(request);
|
||||
|
||||
return response.body.map(entry => {
|
||||
var fileName = entry.file;
|
||||
var start = this.lineOffsetToPosition(fileName, entry.start);
|
||||
var end = this.lineOffsetToPosition(fileName, entry.end);
|
||||
return {
|
||||
containerKind: "",
|
||||
containerName: "",
|
||||
fileName: fileName,
|
||||
textSpan: ts.createTextSpanFromBounds(start, end),
|
||||
kind: "",
|
||||
name: ""
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
findReferences(fileName: string, position: number): ReferencedSymbol[]{
|
||||
// Not yet implemented.
|
||||
return [];
|
||||
|
||||
@@ -398,7 +398,7 @@ module ts.server {
|
||||
|
||||
export class ProjectService {
|
||||
filenameToScriptInfo: ts.Map<ScriptInfo> = {};
|
||||
// open, non-configured root files
|
||||
// open, non-configured root files
|
||||
openFileRoots: ScriptInfo[] = [];
|
||||
// projects built from openFileRoots
|
||||
inferredProjects: Project[] = [];
|
||||
@@ -421,10 +421,10 @@ module ts.server {
|
||||
hostInfo: "Unknown host"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getFormatCodeOptions(file?: string) {
|
||||
if (file) {
|
||||
var info = this.filenameToScriptInfo[file];
|
||||
var info = this.filenameToScriptInfo[file];
|
||||
if (info) {
|
||||
return info.formatCodeOptions;
|
||||
}
|
||||
@@ -448,7 +448,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
log(msg: string, type = "Err") {
|
||||
this.psLogger.msg(msg, type);
|
||||
}
|
||||
@@ -457,17 +457,17 @@ module ts.server {
|
||||
if (args.file) {
|
||||
var info = this.filenameToScriptInfo[args.file];
|
||||
if (info) {
|
||||
info.setFormatOptions(args.formatOptions);
|
||||
info.setFormatOptions(args.formatOptions);
|
||||
this.log("Host configuration update for file " + args.file, "Info");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (args.hostInfo !== undefined) {
|
||||
this.hostConfiguration.hostInfo = args.hostInfo;
|
||||
this.log("Host information " + args.hostInfo, "Info");
|
||||
this.log("Host information " + args.hostInfo, "Info");
|
||||
}
|
||||
if (args.formatOptions) {
|
||||
mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions);
|
||||
mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions);
|
||||
this.log("Format host information updated", "Info");
|
||||
}
|
||||
}
|
||||
@@ -487,7 +487,7 @@ module ts.server {
|
||||
|
||||
fileDeletedInFilesystem(info: ScriptInfo) {
|
||||
this.psLogger.info(info.fileName + " deleted");
|
||||
|
||||
|
||||
if (info.fileWatcher) {
|
||||
info.fileWatcher.close();
|
||||
info.fileWatcher = undefined;
|
||||
@@ -537,7 +537,7 @@ module ts.server {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
addOpenFile(info: ScriptInfo) {
|
||||
if (this.setConfiguredProjectRoot(info)) {
|
||||
this.openFileRootsConfigured.push(info);
|
||||
@@ -561,7 +561,7 @@ module ts.server {
|
||||
copyListRemovingItem(r.defaultProject, this.inferredProjects);
|
||||
// put r in referenced open file list
|
||||
this.openFilesReferenced.push(r);
|
||||
// set default project of r to the new project
|
||||
// set default project of r to the new project
|
||||
r.defaultProject = info.defaultProject;
|
||||
}
|
||||
else {
|
||||
@@ -694,7 +694,7 @@ module ts.server {
|
||||
this.openFilesReferenced = openFilesReferenced;
|
||||
|
||||
// Then, loop through all of the open files that are project roots.
|
||||
// For each root file, note the project that it roots. Then see if
|
||||
// For each root file, note the project that it roots. Then see if
|
||||
// any other projects newly reference the file. If zero projects
|
||||
// newly reference the file, keep it as a root. If one or more
|
||||
// projects newly references the file, remove its project from the
|
||||
@@ -719,7 +719,7 @@ module ts.server {
|
||||
|
||||
// Finally, if we found any open, referenced files that are no longer
|
||||
// referenced by their default project, treat them as newly opened
|
||||
// by the editor.
|
||||
// by the editor.
|
||||
for (var i = 0, len = unattachedOpenFiles.length; i < len; i++) {
|
||||
this.addOpenFile(unattachedOpenFiles[i]);
|
||||
}
|
||||
@@ -750,6 +750,7 @@ module ts.server {
|
||||
if (content !== undefined) {
|
||||
var indentSize: number;
|
||||
info = new ScriptInfo(this.host, fileName, content, openedByClient);
|
||||
info.setFormatOptions(this.getFormatCodeOptions());
|
||||
this.filenameToScriptInfo[fileName] = info;
|
||||
if (!info.isOpen) {
|
||||
info.fileWatcher = this.host.watchFile(fileName, _ => { this.watchedFileChanged(fileName); });
|
||||
@@ -772,7 +773,7 @@ module ts.server {
|
||||
findConfigFile(searchPath: string): string {
|
||||
while (true) {
|
||||
var fileName = ts.combinePaths(searchPath, "tsconfig.json");
|
||||
if (sys.fileExists(fileName)) {
|
||||
if (this.host.fileExists(fileName)) {
|
||||
return fileName;
|
||||
}
|
||||
var parentPath = ts.getDirectoryPath(searchPath);
|
||||
@@ -808,7 +809,7 @@ module ts.server {
|
||||
}
|
||||
else {
|
||||
this.log("Opened configuration file " + configFileName,"Info");
|
||||
this.configuredProjects.push(configResult.project);
|
||||
this.configuredProjects.push(configResult.project);
|
||||
}
|
||||
}
|
||||
var info = this.openFile(fileName, true);
|
||||
@@ -900,29 +901,29 @@ module ts.server {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
openConfigFile(configFilename: string, clientFileName?: string): ProjectOpenResult {
|
||||
configFilename = ts.normalizePath(configFilename);
|
||||
// file references will be relative to dirPath (or absolute)
|
||||
var dirPath = ts.getDirectoryPath(configFilename);
|
||||
var rawConfig = <ProjectOptions>ts.readConfigFile(configFilename);
|
||||
if (!rawConfig) {
|
||||
return { errorMsg: "tsconfig syntax error" };
|
||||
var rawConfig: { config?: ProjectOptions; error?: Diagnostic; } = ts.readConfigFile(configFilename);
|
||||
if (rawConfig.error) {
|
||||
return rawConfig.error;
|
||||
}
|
||||
else {
|
||||
var parsedCommandLine = ts.parseConfigFile(rawConfig, dirPath);
|
||||
var parsedCommandLine = ts.parseConfigFile(rawConfig.config, ts.sys, dirPath);
|
||||
if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) {
|
||||
return { errorMsg: "tsconfig option errors" };
|
||||
}
|
||||
else if (parsedCommandLine.fileNames) {
|
||||
var projectOptions: ProjectOptions = {
|
||||
var projectOptions: ProjectOptions = {
|
||||
files: parsedCommandLine.fileNames,
|
||||
compilerOptions: parsedCommandLine.options
|
||||
};
|
||||
var proj = this.createProject(configFilename, projectOptions);
|
||||
for (var i = 0, len = parsedCommandLine.fileNames.length; i < len; i++) {
|
||||
var rootFilename = parsedCommandLine.fileNames[i];
|
||||
if (ts.sys.fileExists(rootFilename)) {
|
||||
if (this.host.fileExists(rootFilename)) {
|
||||
var info = this.openFile(rootFilename, clientFileName == rootFilename);
|
||||
proj.addRoot(info);
|
||||
}
|
||||
@@ -1039,7 +1040,7 @@ module ts.server {
|
||||
startPath: LineCollection[];
|
||||
endBranch: LineCollection[] = [];
|
||||
branchNode: LineNode;
|
||||
// path to current node
|
||||
// path to current node
|
||||
stack: LineNode[];
|
||||
state = CharRangeSection.Entire;
|
||||
lineCollectionAtBranch: LineCollection;
|
||||
@@ -1241,7 +1242,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
// text change information
|
||||
// text change information
|
||||
class TextChange {
|
||||
constructor(public pos: number, public deleteLen: number, public insertedText?: string) {
|
||||
}
|
||||
@@ -1289,7 +1290,7 @@ module ts.server {
|
||||
if (cb)
|
||||
cb();
|
||||
}
|
||||
|
||||
|
||||
// reload whole script, leaving no change history behind reload
|
||||
reload(script: string) {
|
||||
this.currentVersion++;
|
||||
@@ -1299,7 +1300,7 @@ module ts.server {
|
||||
snap.index = new LineIndex();
|
||||
var lm = LineIndex.linesFromText(script);
|
||||
snap.index.load(lm.lines);
|
||||
// REVIEW: could use linked list
|
||||
// REVIEW: could use linked list
|
||||
for (var i = this.minVersion; i < this.currentVersion; i++) {
|
||||
this.versions[i] = undefined;
|
||||
}
|
||||
@@ -1380,7 +1381,7 @@ module ts.server {
|
||||
return this.index.root.charCount();
|
||||
}
|
||||
|
||||
// this requires linear space so don't hold on to these
|
||||
// this requires linear space so don't hold on to these
|
||||
getLineStartPositions(): number[] {
|
||||
var starts: number[] = [-1];
|
||||
var count = 1;
|
||||
@@ -1642,7 +1643,7 @@ module ts.server {
|
||||
}
|
||||
|
||||
walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) {
|
||||
// assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars)
|
||||
// assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars)
|
||||
var childIndex = 0;
|
||||
var child = this.children[0];
|
||||
var childCharCount = child.charCount();
|
||||
@@ -1728,7 +1729,7 @@ module ts.server {
|
||||
line: lineNumber,
|
||||
offset: charOffset
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (childInfo.child.isLeaf()) {
|
||||
return {
|
||||
line: lineNumber,
|
||||
@@ -1916,4 +1917,4 @@ module ts.server {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+15
@@ -125,6 +125,14 @@ declare module ts.server.protocol {
|
||||
export interface DefinitionRequest extends FileLocationRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Go to type request; value of command field is
|
||||
* "typeDefinition". Return response giving the file locations that
|
||||
* define the type for the symbol found in file at location line, col.
|
||||
*/
|
||||
export interface TypeDefinitionRequest extends FileLocationRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Location in source code expressed as (one-based) line and character offset.
|
||||
*/
|
||||
@@ -165,6 +173,13 @@ declare module ts.server.protocol {
|
||||
body?: FileSpan[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Definition response message. Gives text range for definition.
|
||||
*/
|
||||
export interface TypeDefinitionResponse extends Response {
|
||||
body?: FileSpan[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get occurrences request; value of command field is
|
||||
* "occurrences". Return response giving spans that are relevant
|
||||
|
||||
+30
-2
@@ -97,6 +97,7 @@ module ts.server {
|
||||
export var Rename = "rename";
|
||||
export var Saveto = "saveto";
|
||||
export var SignatureHelp = "signatureHelp";
|
||||
export var TypeDefinition = "typeDefinition";
|
||||
export var Unknown = "unknown";
|
||||
}
|
||||
|
||||
@@ -285,7 +286,29 @@ module ts.server {
|
||||
}));
|
||||
}
|
||||
|
||||
getOccurrences(line: number, offset: number, fileName: string): protocol.OccurrencesResponseItem[] {
|
||||
getTypeDefinition(line: number, offset: number, fileName: string): protocol.FileSpan[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
throw Errors.NoProject;
|
||||
}
|
||||
|
||||
var compilerService = project.compilerService;
|
||||
var position = compilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
|
||||
var definitions = compilerService.languageService.getTypeDefinitionAtPosition(file, position);
|
||||
if (!definitions) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return definitions.map(def => ({
|
||||
file: def.fileName,
|
||||
start: compilerService.host.positionToLineOffset(def.fileName, def.textSpan.start),
|
||||
end: compilerService.host.positionToLineOffset(def.fileName, ts.textSpanEnd(def.textSpan))
|
||||
}));
|
||||
}
|
||||
|
||||
getOccurrences(line: number, offset: number, fileName: string): protocol.OccurrencesResponseItem[]{
|
||||
fileName = ts.normalizePath(fileName);
|
||||
let project = this.projectService.getProjectForFile(fileName);
|
||||
|
||||
@@ -519,7 +542,7 @@ module ts.server {
|
||||
IndentSize: formatOptions.IndentSize,
|
||||
TabSize: formatOptions.TabSize,
|
||||
NewLineCharacter: "\n",
|
||||
ConvertTabsToSpaces: true,
|
||||
ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces,
|
||||
};
|
||||
var indentPosition =
|
||||
compilerService.languageService.getIndentationAtPosition(file, position, editorOptions);
|
||||
@@ -817,6 +840,11 @@ module ts.server {
|
||||
response = this.getDefinition(defArgs.line, defArgs.offset, defArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.TypeDefinition: {
|
||||
var defArgs = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getTypeDefinition(defArgs.line, defArgs.offset, defArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.References: {
|
||||
var refArgs = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getReferences(refArgs.line, refArgs.offset, refArgs.file);
|
||||
|
||||
@@ -401,8 +401,8 @@ module ts.BreakpointResolver {
|
||||
if (forStatement.condition) {
|
||||
return textSpan(forStatement.condition);
|
||||
}
|
||||
if (forStatement.iterator) {
|
||||
return textSpan(forStatement.iterator);
|
||||
if (forStatement.incrementor) {
|
||||
return textSpan(forStatement.incrementor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,14 +446,14 @@ module ts.BreakpointResolver {
|
||||
// fall through.
|
||||
|
||||
case SyntaxKind.CatchClause:
|
||||
return spanInNode((<Block>node.parent).statements[(<Block>node.parent).statements.length - 1]);;
|
||||
return spanInNode(lastOrUndefined((<Block>node.parent).statements));;
|
||||
|
||||
case SyntaxKind.CaseBlock:
|
||||
// breakpoint in last statement of the last clause
|
||||
let caseBlock = <CaseBlock>node.parent;
|
||||
let lastClause = caseBlock.clauses[caseBlock.clauses.length - 1];
|
||||
let lastClause = lastOrUndefined(caseBlock.clauses);
|
||||
if (lastClause) {
|
||||
return spanInNode(lastClause.statements[lastClause.statements.length - 1]);
|
||||
return spanInNode(lastOrUndefined(lastClause.statements));
|
||||
}
|
||||
return undefined;
|
||||
|
||||
|
||||
@@ -323,6 +323,9 @@ module ts.formatting {
|
||||
let previousParent: Node;
|
||||
let previousRangeStartLine: number;
|
||||
|
||||
let lastIndentedLine: number;
|
||||
let indentationOnLastIndentedLine: number;
|
||||
|
||||
let edits: TextChange[] = [];
|
||||
|
||||
formattingScanner.advance();
|
||||
@@ -416,7 +419,9 @@ module ts.formatting {
|
||||
// if node is located on the same line with the parent
|
||||
// - inherit indentation from the parent
|
||||
// - push children if either parent of node itself has non-zero delta
|
||||
indentation = parentDynamicIndentation.getIndentation();
|
||||
indentation = startLine === lastIndentedLine
|
||||
? indentationOnLastIndentedLine
|
||||
: parentDynamicIndentation.getIndentation();
|
||||
delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta);
|
||||
}
|
||||
return {
|
||||
@@ -716,7 +721,6 @@ module ts.formatting {
|
||||
continue;
|
||||
}
|
||||
|
||||
let triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line;
|
||||
switch (triviaItem.kind) {
|
||||
case SyntaxKind.MultiLineCommentTrivia:
|
||||
let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind);
|
||||
@@ -741,6 +745,9 @@ module ts.formatting {
|
||||
if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) {
|
||||
let tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind);
|
||||
insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded);
|
||||
|
||||
lastIndentedLine = tokenStart.line;
|
||||
indentationOnLastIndentedLine = tokenIndentation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ module ts.formatting {
|
||||
if (isStarted) {
|
||||
if (trailingTrivia) {
|
||||
Debug.assert(trailingTrivia.length !== 0);
|
||||
wasNewLine = trailingTrivia[trailingTrivia.length - 1].kind === SyntaxKind.NewLineTrivia;
|
||||
wasNewLine = lastOrUndefined(trailingTrivia).kind === SyntaxKind.NewLineTrivia;
|
||||
}
|
||||
else {
|
||||
wasNewLine = false;
|
||||
|
||||
@@ -312,7 +312,7 @@ module ts.formatting {
|
||||
this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
|
||||
// Add a space around certain TypeScript keywords
|
||||
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBeforeCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.ExtendsKeyword, SyntaxKind.ImplementsKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
|
||||
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
|
||||
@@ -458,7 +458,11 @@ module ts.formatting {
|
||||
case SyntaxKind.BinaryExpression:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
return true;
|
||||
|
||||
|
||||
// equals in binding elements: function foo([[x, y] = [1, 2]])
|
||||
case SyntaxKind.BindingElement:
|
||||
// equals in type X = ...
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
// equal in import a = module('a');
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
// equal in let a = 0;
|
||||
@@ -475,8 +479,6 @@ module ts.formatting {
|
||||
// Technically, "of" is not a binary operator, but format it the same way as "in"
|
||||
case SyntaxKind.ForOfStatement:
|
||||
return context.currentTokenSpan.kind === SyntaxKind.OfKeyword || context.nextTokenSpan.kind === SyntaxKind.OfKeyword;
|
||||
case SyntaxKind.BindingElement:
|
||||
return context.currentTokenSpan.kind === SyntaxKind.EqualsToken || context.nextTokenSpan.kind === SyntaxKind.EqualsToken;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
+122
-78
@@ -1001,6 +1001,8 @@ module ts {
|
||||
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
|
||||
|
||||
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
|
||||
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
findReferences(fileName: string, position: number): ReferencedSymbol[];
|
||||
getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[];
|
||||
@@ -1630,7 +1632,7 @@ module ts {
|
||||
private fileNameToEntry: Map<HostFileInformation>;
|
||||
private _compilationSettings: CompilerOptions;
|
||||
|
||||
constructor(private host: LanguageServiceHost) {
|
||||
constructor(private host: LanguageServiceHost, private getCanonicalFileName: (fileName: string) => string) {
|
||||
// script id => script index
|
||||
this.fileNameToEntry = {};
|
||||
|
||||
@@ -1648,6 +1650,10 @@ module ts {
|
||||
return this._compilationSettings;
|
||||
}
|
||||
|
||||
private normalizeFileName(fileName: string): string {
|
||||
return this.getCanonicalFileName(normalizeSlashes(fileName));
|
||||
}
|
||||
|
||||
private createEntry(fileName: string) {
|
||||
let entry: HostFileInformation;
|
||||
let scriptSnapshot = this.host.getScriptSnapshot(fileName);
|
||||
@@ -1659,15 +1665,15 @@ module ts {
|
||||
};
|
||||
}
|
||||
|
||||
return this.fileNameToEntry[normalizeSlashes(fileName)] = entry;
|
||||
return this.fileNameToEntry[this.normalizeFileName(fileName)] = entry;
|
||||
}
|
||||
|
||||
public getEntry(fileName: string): HostFileInformation {
|
||||
return lookUp(this.fileNameToEntry, normalizeSlashes(fileName));
|
||||
private getEntry(fileName: string): HostFileInformation {
|
||||
return lookUp(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
}
|
||||
|
||||
public contains(fileName: string): boolean {
|
||||
return hasProperty(this.fileNameToEntry, normalizeSlashes(fileName));
|
||||
private contains(fileName: string): boolean {
|
||||
return hasProperty(this.fileNameToEntry, this.normalizeFileName(fileName));
|
||||
}
|
||||
|
||||
public getOrCreateEntry(fileName: string): HostFileInformation {
|
||||
@@ -1682,8 +1688,10 @@ module ts {
|
||||
let fileNames: string[] = [];
|
||||
|
||||
forEachKey(this.fileNameToEntry, key => {
|
||||
if (hasProperty(this.fileNameToEntry, key) && this.fileNameToEntry[key])
|
||||
fileNames.push(key);
|
||||
let entry = this.getEntry(key);
|
||||
if (entry) {
|
||||
fileNames.push(entry.hostFileName);
|
||||
}
|
||||
});
|
||||
|
||||
return fileNames;
|
||||
@@ -2385,7 +2393,7 @@ module ts {
|
||||
|
||||
function synchronizeHostData(): void {
|
||||
// Get a fresh cache of the host information
|
||||
let hostCache = new HostCache(host);
|
||||
let hostCache = new HostCache(host, getCanonicalFileName);
|
||||
|
||||
// If the program is already up-to-date, we can reuse it
|
||||
if (programUpToDate()) {
|
||||
@@ -2406,7 +2414,7 @@ module ts {
|
||||
let newProgram = createProgram(hostCache.getRootFileNames(), newSettings, {
|
||||
getSourceFile: getOrCreateSourceFile,
|
||||
getCancellationToken: () => cancellationToken,
|
||||
getCanonicalFileName: (fileName) => useCaseSensitivefileNames ? fileName : fileName.toLowerCase(),
|
||||
getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitivefileNames,
|
||||
getNewLine: () => host.getNewLine ? host.getNewLine() : "\r\n",
|
||||
getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
|
||||
@@ -3033,7 +3041,8 @@ module ts {
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ |
|
||||
|
||||
case SyntaxKind.ModuleKeyword: // module |
|
||||
case SyntaxKind.ModuleKeyword: // module |
|
||||
case SyntaxKind.NamespaceKeyword: // namespace |
|
||||
return true;
|
||||
|
||||
case SyntaxKind.DotToken:
|
||||
@@ -3501,19 +3510,6 @@ module ts {
|
||||
return ScriptElementKind.unknown;
|
||||
}
|
||||
|
||||
function getTypeKind(type: Type): string {
|
||||
let flags = type.getFlags();
|
||||
|
||||
if (flags & TypeFlags.Enum) return ScriptElementKind.enumElement;
|
||||
if (flags & TypeFlags.Class) return ScriptElementKind.classElement;
|
||||
if (flags & TypeFlags.Interface) return ScriptElementKind.interfaceElement;
|
||||
if (flags & TypeFlags.TypeParameter) return ScriptElementKind.typeParameterElement;
|
||||
if (flags & TypeFlags.Intrinsic) return ScriptElementKind.primitiveType;
|
||||
if (flags & TypeFlags.StringLiteral) return ScriptElementKind.primitiveType;
|
||||
|
||||
return ScriptElementKind.unknown;
|
||||
}
|
||||
|
||||
function getSymbolModifiers(symbol: Symbol): string {
|
||||
return symbol && symbol.declarations && symbol.declarations.length > 0
|
||||
? getNodeModifiers(symbol.declarations[0])
|
||||
@@ -3686,7 +3682,9 @@ module ts {
|
||||
}
|
||||
if (symbolFlags & SymbolFlags.Module) {
|
||||
addNewLineIfDisplayPartsExist();
|
||||
displayParts.push(keywordPart(SyntaxKind.ModuleKeyword));
|
||||
let declaration = <ModuleDeclaration>getDeclarationOfKind(symbol, SyntaxKind.ModuleDeclaration);
|
||||
let isNamespace = declaration && declaration.name && declaration.name.kind === SyntaxKind.Identifier;
|
||||
displayParts.push(keywordPart(isNamespace ? SyntaxKind.NamespaceKeyword : SyntaxKind.ModuleKeyword));
|
||||
displayParts.push(spacePart());
|
||||
addFullSymbolName(symbol);
|
||||
}
|
||||
@@ -3926,6 +3924,71 @@ module ts {
|
||||
};
|
||||
}
|
||||
|
||||
function getDefinitionFromSymbol(symbol: Symbol, node: Node): DefinitionInfo[] {
|
||||
let typeChecker = program.getTypeChecker();
|
||||
let result: DefinitionInfo[] = [];
|
||||
let declarations = symbol.getDeclarations();
|
||||
let symbolName = typeChecker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
|
||||
let symbolKind = getSymbolKind(symbol, node);
|
||||
let containerSymbol = symbol.parent;
|
||||
let containerName = containerSymbol ? typeChecker.symbolToString(containerSymbol, node) : "";
|
||||
|
||||
if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) &&
|
||||
!tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) {
|
||||
// Just add all the declarations.
|
||||
forEach(declarations, declaration => {
|
||||
result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName));
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
function tryAddConstructSignature(symbol: Symbol, location: Node, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
// Applicable only if we are in a new expression, or we are on a constructor declaration
|
||||
// and in either case the symbol has a construct signature definition, i.e. class
|
||||
if (isNewExpressionTarget(location) || location.kind === SyntaxKind.ConstructorKeyword) {
|
||||
if (symbol.flags & SymbolFlags.Class) {
|
||||
let classDeclaration = <ClassDeclaration>symbol.getDeclarations()[0];
|
||||
Debug.assert(classDeclaration && classDeclaration.kind === SyntaxKind.ClassDeclaration);
|
||||
|
||||
return tryAddSignature(classDeclaration.members, /*selectConstructors*/ true, symbolKind, symbolName, containerName, result);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function tryAddCallSignature(symbol: Symbol, location: Node, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
if (isCallExpressionTarget(location) || isNewExpressionTarget(location) || isNameOfFunctionDeclaration(location)) {
|
||||
return tryAddSignature(symbol.declarations, /*selectConstructors*/ false, symbolKind, symbolName, containerName, result);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function tryAddSignature(signatureDeclarations: Declaration[], selectConstructors: boolean, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
let declarations: Declaration[] = [];
|
||||
let definition: Declaration;
|
||||
|
||||
forEach(signatureDeclarations, d => {
|
||||
if ((selectConstructors && d.kind === SyntaxKind.Constructor) ||
|
||||
(!selectConstructors && (d.kind === SyntaxKind.FunctionDeclaration || d.kind === SyntaxKind.MethodDeclaration || d.kind === SyntaxKind.MethodSignature))) {
|
||||
declarations.push(d);
|
||||
if ((<FunctionLikeDeclaration>d).body) definition = d;
|
||||
}
|
||||
});
|
||||
|
||||
if (definition) {
|
||||
result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName));
|
||||
return true;
|
||||
}
|
||||
else if (declarations.length) {
|
||||
result.push(createDefinitionInfo(lastOrUndefined(declarations), symbolKind, symbolName, containerName));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// Goto definition
|
||||
function getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] {
|
||||
synchronizeHostData();
|
||||
@@ -4000,67 +4063,47 @@ module ts {
|
||||
declaration => createDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName));
|
||||
}
|
||||
|
||||
let result: DefinitionInfo[] = [];
|
||||
let declarations = symbol.getDeclarations();
|
||||
let symbolName = typeChecker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol
|
||||
let symbolKind = getSymbolKind(symbol, node);
|
||||
let containerSymbol = symbol.parent;
|
||||
let containerName = containerSymbol ? typeChecker.symbolToString(containerSymbol, node) : "";
|
||||
return getDefinitionFromSymbol(symbol, node);
|
||||
}
|
||||
|
||||
if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) &&
|
||||
!tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) {
|
||||
// Just add all the declarations.
|
||||
forEach(declarations, declaration => {
|
||||
result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName));
|
||||
});
|
||||
/// Goto type
|
||||
function getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] {
|
||||
synchronizeHostData();
|
||||
|
||||
let sourceFile = getValidSourceFile(fileName);
|
||||
|
||||
let node = getTouchingPropertyName(sourceFile, position);
|
||||
if (!node) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return result;
|
||||
let typeChecker = program.getTypeChecker();
|
||||
|
||||
function tryAddConstructSignature(symbol: Symbol, location: Node, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
// Applicable only if we are in a new expression, or we are on a constructor declaration
|
||||
// and in either case the symbol has a construct signature definition, i.e. class
|
||||
if (isNewExpressionTarget(location) || location.kind === SyntaxKind.ConstructorKeyword) {
|
||||
if (symbol.flags & SymbolFlags.Class) {
|
||||
let classDeclaration = <ClassDeclaration>symbol.getDeclarations()[0];
|
||||
Debug.assert(classDeclaration && classDeclaration.kind === SyntaxKind.ClassDeclaration);
|
||||
|
||||
return tryAddSignature(classDeclaration.members, /*selectConstructors*/ true, symbolKind, symbolName, containerName, result);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
let symbol = typeChecker.getSymbolAtLocation(node);
|
||||
if (!symbol) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function tryAddCallSignature(symbol: Symbol, location: Node, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
if (isCallExpressionTarget(location) || isNewExpressionTarget(location) || isNameOfFunctionDeclaration(location)) {
|
||||
return tryAddSignature(symbol.declarations, /*selectConstructors*/ false, symbolKind, symbolName, containerName, result);
|
||||
}
|
||||
return false;
|
||||
let type = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
||||
if (!type) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function tryAddSignature(signatureDeclarations: Declaration[], selectConstructors: boolean, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) {
|
||||
let declarations: Declaration[] = [];
|
||||
let definition: Declaration;
|
||||
|
||||
forEach(signatureDeclarations, d => {
|
||||
if ((selectConstructors && d.kind === SyntaxKind.Constructor) ||
|
||||
(!selectConstructors && (d.kind === SyntaxKind.FunctionDeclaration || d.kind === SyntaxKind.MethodDeclaration || d.kind === SyntaxKind.MethodSignature))) {
|
||||
declarations.push(d);
|
||||
if ((<FunctionLikeDeclaration>d).body) definition = d;
|
||||
if (type.flags & TypeFlags.Union) {
|
||||
var result: DefinitionInfo[] = [];
|
||||
forEach((<UnionType>type).types, t => {
|
||||
if (t.symbol) {
|
||||
result.push(...getDefinitionFromSymbol(t.symbol, node));
|
||||
}
|
||||
});
|
||||
|
||||
if (definition) {
|
||||
result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName));
|
||||
return true;
|
||||
}
|
||||
else if (declarations.length) {
|
||||
result.push(createDefinitionInfo(declarations[declarations.length - 1], symbolKind, symbolName, containerName));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
|
||||
if (!type.symbol) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return getDefinitionFromSymbol(type.symbol, node);
|
||||
}
|
||||
|
||||
function getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
|
||||
@@ -5412,7 +5455,7 @@ module ts {
|
||||
}
|
||||
return;
|
||||
|
||||
function getPropertySymbolFromTypeReference(typeReference: HeritageClauseElement) {
|
||||
function getPropertySymbolFromTypeReference(typeReference: ExpressionWithTypeArguments) {
|
||||
if (typeReference) {
|
||||
let type = typeChecker.getTypeAtLocation(typeReference);
|
||||
if (type) {
|
||||
@@ -5673,7 +5716,7 @@ module ts {
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
return node.parent.kind === SyntaxKind.TypeReference || node.parent.kind === SyntaxKind.HeritageClauseElement;
|
||||
return node.parent.kind === SyntaxKind.TypeReference || node.parent.kind === SyntaxKind.ExpressionWithTypeArguments;
|
||||
}
|
||||
|
||||
function isNamespaceReference(node: Node): boolean {
|
||||
@@ -5691,7 +5734,7 @@ module ts {
|
||||
isLastClause = (<PropertyAccessExpression>root).name === node;
|
||||
}
|
||||
|
||||
if (!isLastClause && root.parent.kind === SyntaxKind.HeritageClauseElement && root.parent.parent.kind === SyntaxKind.HeritageClause) {
|
||||
if (!isLastClause && root.parent.kind === SyntaxKind.ExpressionWithTypeArguments && root.parent.parent.kind === SyntaxKind.HeritageClause) {
|
||||
let decl = root.parent.parent.parent;
|
||||
return (decl.kind === SyntaxKind.ClassDeclaration && (<HeritageClause>root.parent.parent).token === SyntaxKind.ImplementsKeyword) ||
|
||||
(decl.kind === SyntaxKind.InterfaceDeclaration && (<HeritageClause>root.parent.parent).token === SyntaxKind.ExtendsKeyword);
|
||||
@@ -6493,6 +6536,7 @@ module ts {
|
||||
getSignatureHelpItems,
|
||||
getQuickInfoAtPosition,
|
||||
getDefinitionAtPosition,
|
||||
getTypeDefinitionAtPosition,
|
||||
getReferencesAtPosition,
|
||||
findReferences,
|
||||
getOccurrencesAtPosition,
|
||||
|
||||
+82
-14
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// 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
|
||||
@@ -57,6 +57,12 @@ module ts {
|
||||
getNewLine?(): string;
|
||||
}
|
||||
|
||||
/** Public interface of the the of a config service shim instance.*/
|
||||
export interface CoreServicesShimHost extends Logger {
|
||||
/** Returns a JSON-encoded value of the type: string[] */
|
||||
readDirectory(rootDir: string, extension: string): string;
|
||||
}
|
||||
|
||||
///
|
||||
/// Pre-processing
|
||||
///
|
||||
@@ -126,12 +132,20 @@ module ts {
|
||||
*/
|
||||
getDefinitionAtPosition(fileName: string, position: number): string;
|
||||
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type:
|
||||
* { fileName: string; textSpan: { start: number; length: number}; kind: string; name: string; containerKind: string; containerName: string }
|
||||
*
|
||||
* Or undefined value if no definition can be found.
|
||||
*/
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): string;
|
||||
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type:
|
||||
* { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[]
|
||||
*/
|
||||
getReferencesAtPosition(fileName: string, position: number): string;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type:
|
||||
* { definition: <encoded>; references: <encoded>[] }[]
|
||||
@@ -148,8 +162,8 @@ module ts {
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type:
|
||||
* { fileName: string; highlights: { start: number; length: number, isDefinition: boolean }[] }[]
|
||||
*
|
||||
* @param fileToSearch A JSON encoded string[] containing the file names that should be
|
||||
*
|
||||
* @param fileToSearch A JSON encoded string[] containing the file names that should be
|
||||
* considered when searching.
|
||||
*/
|
||||
getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string;
|
||||
@@ -191,6 +205,7 @@ module ts {
|
||||
|
||||
export interface CoreServicesShim extends Shim {
|
||||
getPreProcessedFileInfo(fileName: string, sourceText: IScriptSnapshot): string;
|
||||
getTSConfigFileInfo(fileName: string, sourceText: IScriptSnapshot): string;
|
||||
getDefaultCompilationSettings(): string;
|
||||
}
|
||||
|
||||
@@ -229,7 +244,7 @@ module ts {
|
||||
|
||||
export class LanguageServiceShimHostAdapter implements LanguageServiceHost {
|
||||
private files: string[];
|
||||
|
||||
|
||||
constructor(private shimHost: LanguageServiceShimHost) {
|
||||
}
|
||||
|
||||
@@ -240,7 +255,7 @@ module ts {
|
||||
public trace(s: string): void {
|
||||
this.shimHost.trace(s);
|
||||
}
|
||||
|
||||
|
||||
public error(s: string): void {
|
||||
this.shimHost.error(s);
|
||||
}
|
||||
@@ -308,6 +323,17 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
export class CoreServicesShimHostAdapter implements ParseConfigHost {
|
||||
|
||||
constructor(private shimHost: CoreServicesShimHost) {
|
||||
}
|
||||
|
||||
public readDirectory(rootDir: string, extension: string): string[] {
|
||||
var encoded = this.shimHost.readDirectory(rootDir, extension);
|
||||
return JSON.parse(encoded);
|
||||
}
|
||||
}
|
||||
|
||||
function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any, noPerfLogging: boolean): any {
|
||||
if (!noPerfLogging) {
|
||||
logger.log(actionDescription);
|
||||
@@ -561,7 +587,7 @@ module ts {
|
||||
|
||||
/**
|
||||
* Computes the definition location and file for the symbol
|
||||
* at the requested position.
|
||||
* at the requested position.
|
||||
*/
|
||||
public getDefinitionAtPosition(fileName: string, position: number): string {
|
||||
return this.forwardJSONCall(
|
||||
@@ -571,6 +597,20 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
/// GOTO Type
|
||||
|
||||
/**
|
||||
* Computes the definition location of the type of the symbol
|
||||
* at the requested position.
|
||||
*/
|
||||
public getTypeDefinitionAtPosition(fileName: string, position: number): string {
|
||||
return this.forwardJSONCall(
|
||||
"getTypeDefinitionAtPosition('" + fileName + "', " + position + ")",
|
||||
() => {
|
||||
return this.languageService.getTypeDefinitionAtPosition(fileName, position);
|
||||
});
|
||||
}
|
||||
|
||||
public getRenameInfo(fileName: string, position: number): string {
|
||||
return this.forwardJSONCall(
|
||||
"getRenameInfo('" + fileName + "', " + position + ")",
|
||||
@@ -644,8 +684,8 @@ module ts {
|
||||
/// COMPLETION LISTS
|
||||
|
||||
/**
|
||||
* Get a string based representation of the completions
|
||||
* to provide at the given source position and providing a member completion
|
||||
* Get a string based representation of the completions
|
||||
* to provide at the given source position and providing a member completion
|
||||
* list if requested.
|
||||
*/
|
||||
public getCompletionsAtPosition(fileName: string, position: number) {
|
||||
@@ -783,7 +823,8 @@ module ts {
|
||||
}
|
||||
|
||||
class CoreServicesShimObject extends ShimBase implements CoreServicesShim {
|
||||
constructor(factory: ShimFactory, public logger: Logger) {
|
||||
|
||||
constructor(factory: ShimFactory, public logger: Logger, private host: CoreServicesShimHostAdapter) {
|
||||
super(factory);
|
||||
}
|
||||
|
||||
@@ -821,6 +862,32 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
public getTSConfigFileInfo(fileName: string, sourceTextSnapshot: IScriptSnapshot): string {
|
||||
return this.forwardJSONCall(
|
||||
"getTSConfigFileInfo('" + fileName + "')",
|
||||
() => {
|
||||
let text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength());
|
||||
|
||||
let result = parseConfigFileText(fileName, text);
|
||||
|
||||
if (result.error) {
|
||||
return {
|
||||
options: {},
|
||||
files: [],
|
||||
errors: [realizeDiagnostic(result.error, '\r\n')]
|
||||
};
|
||||
}
|
||||
|
||||
var configFile = parseConfigFile(result.config, this.host, getDirectoryPath(normalizeSlashes(fileName)));
|
||||
|
||||
return {
|
||||
options: configFile.options,
|
||||
files: configFile.fileNames,
|
||||
errors: [realizeDiagnostics(configFile.errors, '\r\n')]
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
public getDefaultCompilationSettings(): string {
|
||||
return this.forwardJSONCall(
|
||||
"getDefaultCompilationSettings()",
|
||||
@@ -863,12 +930,13 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
public createCoreServicesShim(logger: Logger): CoreServicesShim {
|
||||
public createCoreServicesShim(host: CoreServicesShimHost): CoreServicesShim {
|
||||
try {
|
||||
return new CoreServicesShimObject(this, logger);
|
||||
var adapter = new CoreServicesShimHostAdapter(host);
|
||||
return new CoreServicesShimObject(this, <Logger>host, adapter);
|
||||
}
|
||||
catch (err) {
|
||||
logInternalError(logger, err);
|
||||
logInternalError(<Logger>host, err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
@@ -911,4 +979,4 @@ module TypeScript.Services {
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
const toolsVersion = "1.5";
|
||||
let toolsVersion = "1.4";
|
||||
|
||||
@@ -18,11 +18,14 @@
|
||||
"../compiler/checker.ts",
|
||||
"../compiler/emitter.ts",
|
||||
"../compiler/program.ts",
|
||||
"../compiler/commandLineParser.ts",
|
||||
"../compiler/declarationEmitter.ts",
|
||||
"../compiler/diagnosticInformationMap.generated.ts",
|
||||
"../compiler/commandLineParser.ts",
|
||||
"breakpoints.ts",
|
||||
"navigateTo.ts",
|
||||
"navigationBar.ts",
|
||||
"outliningElementsCollector.ts",
|
||||
"patternMatcher.ts",
|
||||
"services.ts",
|
||||
"shims.ts",
|
||||
"signatureHelp.ts",
|
||||
|
||||
@@ -200,7 +200,7 @@ module ts {
|
||||
function nodeEndsWith(n: Node, expectedLastToken: SyntaxKind, sourceFile: SourceFile): boolean {
|
||||
let children = n.getChildren(sourceFile);
|
||||
if (children.length) {
|
||||
let last = children[children.length - 1];
|
||||
let last = lastOrUndefined(children);
|
||||
if (last.kind === expectedLastToken) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -75,26 +75,26 @@ function delint(sourceFile) {
|
||||
delintNode(sourceFile);
|
||||
function delintNode(node) {
|
||||
switch (node.kind) {
|
||||
case 186 /* ForStatement */:
|
||||
case 187 /* ForInStatement */:
|
||||
case 185 /* WhileStatement */:
|
||||
case 184 /* DoStatement */:
|
||||
if (node.statement.kind !== 179 /* Block */) {
|
||||
case 187 /* ForStatement */:
|
||||
case 188 /* ForInStatement */:
|
||||
case 186 /* WhileStatement */:
|
||||
case 185 /* DoStatement */:
|
||||
if (node.statement.kind !== 180 /* Block */) {
|
||||
report(node, "A looping statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
case 183 /* IfStatement */:
|
||||
case 184 /* IfStatement */:
|
||||
var ifStatement = node;
|
||||
if (ifStatement.thenStatement.kind !== 179 /* Block */) {
|
||||
if (ifStatement.thenStatement.kind !== 180 /* Block */) {
|
||||
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
if (ifStatement.elseStatement &&
|
||||
ifStatement.elseStatement.kind !== 179 /* Block */ &&
|
||||
ifStatement.elseStatement.kind !== 183 /* IfStatement */) {
|
||||
ifStatement.elseStatement.kind !== 180 /* Block */ &&
|
||||
ifStatement.elseStatement.kind !== 184 /* IfStatement */) {
|
||||
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
case 169 /* BinaryExpression */:
|
||||
case 170 /* BinaryExpression */:
|
||||
var op = node.operatorToken.kind;
|
||||
if (op === 28 /* EqualsEqualsToken */ || op == 29 /* ExclamationEqualsToken */) {
|
||||
report(node, "Use '===' and '!=='.");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
|
||||
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/class.ts (0 errors) ====
|
||||
@@ -17,7 +17,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): erro
|
||||
module X.Y {
|
||||
export module Point {
|
||||
~~~~~
|
||||
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
|
||||
export var Origin = new Point(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
|
||||
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/class.ts (0 errors) ====
|
||||
@@ -17,7 +17,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): erro
|
||||
module X.Y {
|
||||
export module Point {
|
||||
~~~~~
|
||||
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
|
||||
export var Origin = new Point(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/ExportAssignment7.ts(1,14): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
tests/cases/compiler/ExportAssignment7.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided.
|
||||
tests/cases/compiler/ExportAssignment7.ts(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
|
||||
tests/cases/compiler/ExportAssignment7.ts(4,10): error TS2304: Cannot find name 'B'.
|
||||
|
||||
@@ -6,7 +6,7 @@ tests/cases/compiler/ExportAssignment7.ts(4,10): error TS2304: Cannot find name
|
||||
==== tests/cases/compiler/ExportAssignment7.ts (3 errors) ====
|
||||
export class C {
|
||||
~
|
||||
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
|
||||
}
|
||||
|
||||
export = B;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/ExportAssignment8.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
tests/cases/compiler/ExportAssignment8.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
|
||||
tests/cases/compiler/ExportAssignment8.ts(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
|
||||
tests/cases/compiler/ExportAssignment8.ts(1,10): error TS2304: Cannot find name 'B'.
|
||||
|
||||
@@ -6,7 +6,7 @@ tests/cases/compiler/ExportAssignment8.ts(1,10): error TS2304: Cannot find name
|
||||
==== tests/cases/compiler/ExportAssignment8.ts (3 errors) ====
|
||||
export = B;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
|
||||
~
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ module A {
|
||||
|
||||
|
||||
//// [ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ module A {
|
||||
|
||||
|
||||
//// [ExportClassWithInaccessibleTypeInTypeParameterConstraint.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'.
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'.
|
||||
|
||||
@@ -14,7 +14,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error T
|
||||
module A {
|
||||
export module Point {
|
||||
~~~~~
|
||||
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
|
||||
export var Origin = { x: 0, y: 0 };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
|
||||
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ====
|
||||
module X.Y {
|
||||
export module Point {
|
||||
~~~~~
|
||||
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
|
||||
export var Origin = new Point(0, 0);
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts (1 errors) ====
|
||||
module A {
|
||||
~
|
||||
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
|
||||
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
|
||||
export var Instance = new A();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(3,19): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(3,19): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
|
||||
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ====
|
||||
module A {
|
||||
export module Point {
|
||||
~~~~~
|
||||
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
|
||||
export var Origin = { x: 0, y: 0 };
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(3,19): erro
|
||||
|
||||
export module Point {
|
||||
~~~~~
|
||||
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
|
||||
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
|
||||
export var Origin = { x: 0, y: 0 };
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/part1.ts(1,15): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/part1.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided.
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(3,24): error TS2304: Cannot find name 'Point'.
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,36): error TS2304: Cannot find name 'Point'.
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,54): error TS2304: Cannot find name 'Point'.
|
||||
@@ -7,7 +7,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,54): error
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts (1 errors) ====
|
||||
export module A {
|
||||
~
|
||||
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
|
||||
export interface Point {
|
||||
x: number;
|
||||
y: number;
|
||||
|
||||
@@ -16,7 +16,7 @@ class ColoredPoint extends Point {
|
||||
|
||||
|
||||
//// [accessOverriddenBaseClassMember1.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -25,7 +25,7 @@ class LanguageSpec_section_4_5_inference {
|
||||
}
|
||||
|
||||
//// [accessors_spec_section-4.5_inference.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/compiler/aliasErrors.ts(11,12): error TS2304: Cannot find name 'no'.
|
||||
tests/cases/compiler/aliasErrors.ts(12,13): error TS2304: Cannot find name 'no'.
|
||||
tests/cases/compiler/aliasErrors.ts(11,12): error TS2503: Cannot find namespace 'no'.
|
||||
tests/cases/compiler/aliasErrors.ts(12,13): error TS2503: Cannot find namespace 'no'.
|
||||
tests/cases/compiler/aliasErrors.ts(13,12): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/aliasErrors.ts(14,12): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/aliasErrors.ts(15,12): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/aliasErrors.ts(16,12): error TS2304: Cannot find name 'undefined'.
|
||||
tests/cases/compiler/aliasErrors.ts(16,12): error TS2503: Cannot find namespace 'undefined'.
|
||||
tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' has no exported member 'bar'.
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' h
|
||||
|
||||
import m = no;
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'no'.
|
||||
!!! error TS2503: Cannot find namespace 'no'.
|
||||
import m2 = no.mod;
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'no'.
|
||||
!!! error TS2503: Cannot find namespace 'no'.
|
||||
import n = 5;
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
@@ -35,7 +35,7 @@ tests/cases/compiler/aliasErrors.ts(26,15): error TS2305: Module 'foo.bar.baz' h
|
||||
!!! error TS1003: Identifier expected.
|
||||
import r = undefined;
|
||||
~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'undefined'.
|
||||
!!! error TS2503: Cannot find namespace 'undefined'.
|
||||
|
||||
|
||||
var p = new provide.Provide();
|
||||
|
||||
@@ -35,7 +35,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsage1_moduleA.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -29,7 +29,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInArray_moduleA.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -28,7 +28,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInFunctionExpression_moduleA.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -32,7 +32,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInGenericFunction_moduleA.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -34,7 +34,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInIndexerOfClass_moduleA.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -29,7 +29,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInObjectLiteral_moduleA.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -32,7 +32,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInOrExpression_moduleA.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -32,7 +32,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
@@ -48,7 +48,7 @@ var VisualizationModel = (function (_super) {
|
||||
})(Backbone.Model);
|
||||
exports.VisualizationModel = VisualizationModel;
|
||||
//// [aliasUsageInTypeArgumentOfExtendsClause_main.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -28,7 +28,7 @@ var Model = (function () {
|
||||
})();
|
||||
exports.Model = Model;
|
||||
//// [aliasUsageInVarAssignment_moduleA.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/conformance/ambient/consumer.ts(2,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
tests/cases/conformance/ambient/consumer.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
|
||||
|
||||
|
||||
==== tests/cases/conformance/ambient/consumer.ts (1 errors) ====
|
||||
/// <reference path="decls.ts" />
|
||||
import imp1 = require('equ');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
|
||||
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
|
||||
|
||||
|
||||
// Ambient external module members are always exported with or without export keyword when module lacks export assignment
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
tests/cases/conformance/ambient/ambientEnumDeclaration1.ts(5,5): error TS1066: Ambient enum elements can only have integer literal initializers.
|
||||
tests/cases/conformance/ambient/ambientEnumDeclaration1.ts(6,5): error TS1066: Ambient enum elements can only have integer literal initializers.
|
||||
tests/cases/conformance/ambient/ambientEnumDeclaration1.ts(7,5): error TS1066: Ambient enum elements can only have integer literal initializers.
|
||||
tests/cases/conformance/ambient/ambientEnumDeclaration1.ts(8,5): error TS1066: Ambient enum elements can only have integer literal initializers.
|
||||
|
||||
|
||||
==== tests/cases/conformance/ambient/ambientEnumDeclaration1.ts (4 errors) ====
|
||||
// In ambient enum declarations, all values specified in enum member declarations must be classified as constant enum expressions.
|
||||
|
||||
declare enum E {
|
||||
a = 10,
|
||||
b = 10 + 1,
|
||||
~
|
||||
!!! error TS1066: Ambient enum elements can only have integer literal initializers.
|
||||
c = b,
|
||||
~
|
||||
!!! error TS1066: Ambient enum elements can only have integer literal initializers.
|
||||
d = (c) + 1,
|
||||
~
|
||||
!!! error TS1066: Ambient enum elements can only have integer literal initializers.
|
||||
e = 10 << 2 * 8,
|
||||
~
|
||||
!!! error TS1066: Ambient enum elements can only have integer literal initializers.
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [ambientEnumDeclaration1.ts]
|
||||
// In ambient enum declarations, all values specified in enum member declarations must be classified as constant enum expressions.
|
||||
|
||||
declare enum E {
|
||||
a = 10,
|
||||
b = 10 + 1,
|
||||
c = b,
|
||||
d = (c) + 1,
|
||||
e = 10 << 2 * 8,
|
||||
}
|
||||
|
||||
//// [ambientEnumDeclaration1.js]
|
||||
// In ambient enum declarations, all values specified in enum member declarations must be classified as constant enum expressions.
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [ambientEnumDeclaration2.ts]
|
||||
// In ambient enum declarations that specify no const modifier, enum member declarations
|
||||
// that omit a value are considered computed members (as opposed to having auto- incremented values assigned).
|
||||
|
||||
declare enum E {
|
||||
a, // E.a
|
||||
b, // E.b
|
||||
}
|
||||
|
||||
declare const enum E1 {
|
||||
a, // E.a = 0
|
||||
b, // E.b = 1
|
||||
}
|
||||
|
||||
//// [ambientEnumDeclaration2.js]
|
||||
// In ambient enum declarations that specify no const modifier, enum member declarations
|
||||
// that omit a value are considered computed members (as opposed to having auto- incremented values assigned).
|
||||
@@ -0,0 +1,23 @@
|
||||
=== tests/cases/conformance/ambient/ambientEnumDeclaration2.ts ===
|
||||
// In ambient enum declarations that specify no const modifier, enum member declarations
|
||||
// that omit a value are considered computed members (as opposed to having auto- incremented values assigned).
|
||||
|
||||
declare enum E {
|
||||
>E : Symbol(E, Decl(ambientEnumDeclaration2.ts, 0, 0))
|
||||
|
||||
a, // E.a
|
||||
>a : Symbol(E.a, Decl(ambientEnumDeclaration2.ts, 3, 16))
|
||||
|
||||
b, // E.b
|
||||
>b : Symbol(E.b, Decl(ambientEnumDeclaration2.ts, 4, 6))
|
||||
}
|
||||
|
||||
declare const enum E1 {
|
||||
>E1 : Symbol(E1, Decl(ambientEnumDeclaration2.ts, 6, 1))
|
||||
|
||||
a, // E.a = 0
|
||||
>a : Symbol(E1.a, Decl(ambientEnumDeclaration2.ts, 8, 23))
|
||||
|
||||
b, // E.b = 1
|
||||
>b : Symbol(E1.b, Decl(ambientEnumDeclaration2.ts, 9, 6))
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
=== tests/cases/conformance/ambient/ambientEnumDeclaration2.ts ===
|
||||
// In ambient enum declarations that specify no const modifier, enum member declarations
|
||||
// that omit a value are considered computed members (as opposed to having auto- incremented values assigned).
|
||||
|
||||
declare enum E {
|
||||
>E : E
|
||||
|
||||
a, // E.a
|
||||
>a : E
|
||||
|
||||
b, // E.b
|
||||
>b : E
|
||||
}
|
||||
|
||||
declare const enum E1 {
|
||||
>E1 : E1
|
||||
|
||||
a, // E.a = 0
|
||||
>a : E1
|
||||
|
||||
b, // E.b = 1
|
||||
>b : E1
|
||||
}
|
||||
@@ -11,8 +11,8 @@ tests/cases/conformance/ambient/ambientErrors.ts(38,13): error TS1039: Initializ
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(39,23): error TS1184: An implementation cannot be declared in ambient contexts.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(40,14): error TS1184: An implementation cannot be declared in ambient contexts.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(41,22): error TS1184: An implementation cannot be declared in ambient contexts.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient external modules cannot be nested in other modules.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient external module declaration cannot specify relative module name.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient modules cannot be nested in other modules.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements.
|
||||
|
||||
|
||||
@@ -91,13 +91,13 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export
|
||||
module M2 {
|
||||
declare module 'nope' { }
|
||||
~~~~~~
|
||||
!!! error TS2435: Ambient external modules cannot be nested in other modules.
|
||||
!!! error TS2435: Ambient modules cannot be nested in other modules.
|
||||
}
|
||||
|
||||
// Ambient external module with a string literal name that isn't a top level external module name
|
||||
declare module '../foo' { }
|
||||
~~~~~~~~
|
||||
!!! error TS2436: Ambient external module declaration cannot specify relative module name.
|
||||
!!! error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
|
||||
// Ambient external module with export assignment and other exported members
|
||||
declare module 'bar' {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(5,16): error TS2435: Ambient external modules cannot be nested in other modules.
|
||||
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): error TS2307: Cannot find external module 'ext'.
|
||||
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(5,16): error TS2435: Ambient modules cannot be nested in other modules.
|
||||
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): error TS2307: Cannot find module 'ext'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts (2 errors) ====
|
||||
@@ -9,12 +9,12 @@ tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): err
|
||||
|
||||
declare module "ext" {
|
||||
~~~~~
|
||||
!!! error TS2435: Ambient external modules cannot be nested in other modules.
|
||||
!!! error TS2435: Ambient modules cannot be nested in other modules.
|
||||
export class C { }
|
||||
}
|
||||
|
||||
// Cannot resolve this ext module reference
|
||||
import ext = require("ext");
|
||||
~~~~~
|
||||
!!! error TS2307: Cannot find external module 'ext'.
|
||||
!!! error TS2307: Cannot find module 'ext'.
|
||||
var x = ext;
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts(2,27): error TS2435: Ambient external modules cannot be nested in other modules.
|
||||
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts(2,27): error TS2435: Ambient modules cannot be nested in other modules.
|
||||
|
||||
|
||||
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts (1 errors) ====
|
||||
module M {
|
||||
export declare module "M" { }
|
||||
~~~
|
||||
!!! error TS2435: Ambient external modules cannot be nested in other modules.
|
||||
!!! error TS2435: Ambient modules cannot be nested in other modules.
|
||||
}
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,23): error TS2435: Ambient external modules cannot be nested in other modules.
|
||||
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,23): error TS2435: Ambient modules cannot be nested in other modules.
|
||||
|
||||
|
||||
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts (1 errors) ====
|
||||
export declare module "M" { }
|
||||
~~~
|
||||
!!! error TS2435: Ambient external modules cannot be nested in other modules.
|
||||
!!! error TS2435: Ambient modules cannot be nested in other modules.
|
||||
+4
-4
@@ -1,14 +1,14 @@
|
||||
tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,5): error TS2439: Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name.
|
||||
tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,25): error TS2307: Cannot find external module './SubModule'.
|
||||
tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,5): error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,25): error TS2307: Cannot find module './SubModule'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts (2 errors) ====
|
||||
declare module "OuterModule" {
|
||||
import m2 = require("./SubModule");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2439: Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name.
|
||||
!!! error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find external module './SubModule'.
|
||||
!!! error TS2307: Cannot find module './SubModule'.
|
||||
class SubModule {
|
||||
public static StaticVar: number;
|
||||
public InstanceVar: number;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts(1,16): error TS2436: Ambient external module declaration cannot specify relative module name.
|
||||
tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts(5,16): error TS2436: Ambient external module declaration cannot specify relative module name.
|
||||
tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts(1,16): error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts(5,16): error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
|
||||
|
||||
==== tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts (2 errors) ====
|
||||
declare module "./relativeModule" {
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2436: Ambient external module declaration cannot specify relative module name.
|
||||
!!! error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
var x: string;
|
||||
}
|
||||
|
||||
declare module ".\\relativeModule" {
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2436: Ambient external module declaration cannot specify relative module name.
|
||||
!!! error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
var x: string;
|
||||
}
|
||||
@@ -9,7 +9,7 @@ var x: B;
|
||||
var t: number = f(x, x); // Not an error
|
||||
|
||||
//// [ambiguousOverloadResolution.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/amdDependencyComment1.ts(3,21): error TS2307: Cannot find external module 'm2'.
|
||||
tests/cases/compiler/amdDependencyComment1.ts(3,21): error TS2307: Cannot find module 'm2'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/amdDependencyComment1.ts (1 errors) ====
|
||||
@@ -6,5 +6,5 @@ tests/cases/compiler/amdDependencyComment1.ts(3,21): error TS2307: Cannot find e
|
||||
|
||||
import m1 = require("m2")
|
||||
~~~~
|
||||
!!! error TS2307: Cannot find external module 'm2'.
|
||||
!!! error TS2307: Cannot find module 'm2'.
|
||||
m1.f();
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/amdDependencyComment2.ts(3,21): error TS2307: Cannot find external module 'm2'.
|
||||
tests/cases/compiler/amdDependencyComment2.ts(3,21): error TS2307: Cannot find module 'm2'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/amdDependencyComment2.ts (1 errors) ====
|
||||
@@ -6,5 +6,5 @@ tests/cases/compiler/amdDependencyComment2.ts(3,21): error TS2307: Cannot find e
|
||||
|
||||
import m1 = require("m2")
|
||||
~~~~
|
||||
!!! error TS2307: Cannot find external module 'm2'.
|
||||
!!! error TS2307: Cannot find module 'm2'.
|
||||
m1.f();
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/amdDependencyCommentName1.ts(3,21): error TS2307: Cannot find external module 'm2'.
|
||||
tests/cases/compiler/amdDependencyCommentName1.ts(3,21): error TS2307: Cannot find module 'm2'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/amdDependencyCommentName1.ts (1 errors) ====
|
||||
@@ -6,5 +6,5 @@ tests/cases/compiler/amdDependencyCommentName1.ts(3,21): error TS2307: Cannot fi
|
||||
|
||||
import m1 = require("m2")
|
||||
~~~~
|
||||
!!! error TS2307: Cannot find external module 'm2'.
|
||||
!!! error TS2307: Cannot find module 'm2'.
|
||||
m1.f();
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/amdDependencyCommentName2.ts(3,21): error TS2307: Cannot find external module 'm2'.
|
||||
tests/cases/compiler/amdDependencyCommentName2.ts(3,21): error TS2307: Cannot find module 'm2'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/amdDependencyCommentName2.ts (1 errors) ====
|
||||
@@ -6,5 +6,5 @@ tests/cases/compiler/amdDependencyCommentName2.ts(3,21): error TS2307: Cannot fi
|
||||
|
||||
import m1 = require("m2")
|
||||
~~~~
|
||||
!!! error TS2307: Cannot find external module 'm2'.
|
||||
!!! error TS2307: Cannot find module 'm2'.
|
||||
m1.f();
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/amdDependencyCommentName3.ts(5,21): error TS2307: Cannot find external module 'm2'.
|
||||
tests/cases/compiler/amdDependencyCommentName3.ts(5,21): error TS2307: Cannot find module 'm2'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/amdDependencyCommentName3.ts (1 errors) ====
|
||||
@@ -8,5 +8,5 @@ tests/cases/compiler/amdDependencyCommentName3.ts(5,21): error TS2307: Cannot fi
|
||||
|
||||
import m1 = require("m2")
|
||||
~~~~
|
||||
!!! error TS2307: Cannot find external module 'm2'.
|
||||
!!! error TS2307: Cannot find module 'm2'.
|
||||
m1.f();
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/compiler/amdDependencyCommentName4.ts(8,21): error TS2307: Cannot find external module 'aliasedModule1'.
|
||||
tests/cases/compiler/amdDependencyCommentName4.ts(11,26): error TS2307: Cannot find external module 'aliasedModule2'.
|
||||
tests/cases/compiler/amdDependencyCommentName4.ts(14,15): error TS2307: Cannot find external module 'aliasedModule3'.
|
||||
tests/cases/compiler/amdDependencyCommentName4.ts(17,21): error TS2307: Cannot find external module 'aliasedModule4'.
|
||||
tests/cases/compiler/amdDependencyCommentName4.ts(8,21): error TS2307: Cannot find module 'aliasedModule1'.
|
||||
tests/cases/compiler/amdDependencyCommentName4.ts(11,26): error TS2307: Cannot find module 'aliasedModule2'.
|
||||
tests/cases/compiler/amdDependencyCommentName4.ts(14,15): error TS2307: Cannot find module 'aliasedModule3'.
|
||||
tests/cases/compiler/amdDependencyCommentName4.ts(17,21): error TS2307: Cannot find module 'aliasedModule4'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/amdDependencyCommentName4.ts (4 errors) ====
|
||||
@@ -14,22 +14,22 @@ tests/cases/compiler/amdDependencyCommentName4.ts(17,21): error TS2307: Cannot f
|
||||
|
||||
import r1 = require("aliasedModule1");
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find external module 'aliasedModule1'.
|
||||
!!! error TS2307: Cannot find module 'aliasedModule1'.
|
||||
r1;
|
||||
|
||||
import {p1, p2, p3} from "aliasedModule2";
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find external module 'aliasedModule2'.
|
||||
!!! error TS2307: Cannot find module 'aliasedModule2'.
|
||||
p1;
|
||||
|
||||
import d from "aliasedModule3";
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find external module 'aliasedModule3'.
|
||||
!!! error TS2307: Cannot find module 'aliasedModule3'.
|
||||
d;
|
||||
|
||||
import * as ns from "aliasedModule4";
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find external module 'aliasedModule4'.
|
||||
!!! error TS2307: Cannot find module 'aliasedModule4'.
|
||||
ns;
|
||||
|
||||
import "unaliasedModule2";
|
||||
@@ -24,7 +24,7 @@ class Derived2<U extends String> extends Base2 { // error because of the prototy
|
||||
//// [apparentTypeSubtyping.js]
|
||||
// subtype checks use the apparent type of the target type
|
||||
// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S:
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -14,7 +14,7 @@ class Derived<U extends String> extends Base { // error
|
||||
//// [apparentTypeSupertype.js]
|
||||
// subtype checks use the apparent type of the target type
|
||||
// S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S:
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
tests/cases/conformance/expressions/contextualTyping/argumentExpressionContextualTyping.ts(16,5): error TS2345: Argument of type '(string | number | boolean)[]' is not assignable to parameter of type '[string, number, boolean]'.
|
||||
Property '0' is missing in type '(string | number | boolean)[]'.
|
||||
tests/cases/conformance/expressions/contextualTyping/argumentExpressionContextualTyping.ts(17,5): error TS2345: Argument of type '(string | number | boolean)[]' is not assignable to parameter of type '[string, number, boolean]'.
|
||||
tests/cases/conformance/expressions/contextualTyping/argumentExpressionContextualTyping.ts(18,5): error TS2345: Argument of type '{ x: (string | number)[]; y: { c: boolean; d: string; e: number; }; }' is not assignable to parameter of type '{ x: [any, any]; y: { c: any; d: any; e: any; }; }'.
|
||||
Types of property 'x' are incompatible.
|
||||
Type '(string | number)[]' is not assignable to type '[any, any]'.
|
||||
Property '0' is missing in type '(string | number)[]'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/contextualTyping/argumentExpressionContextualTyping.ts (3 errors) ====
|
||||
// In a typed function call, argument expressions are contextually typed by their corresponding parameter types.
|
||||
function foo({x: [a, b], y: {c, d, e}}) { }
|
||||
function bar({x: [a, b = 10], y: {c, d, e = { f:1 }}}) { }
|
||||
function baz(x: [string, number, boolean]) { }
|
||||
|
||||
var o = { x: ["string", 1], y: { c: true, d: "world", e: 3 } };
|
||||
var o1: { x: [string, number], y: { c: boolean, d: string, e: number } } = { x: ["string", 1], y: { c: true, d: "world", e: 3 } };
|
||||
foo(o1); // Not error since x has contextual type of tuple namely [string, number]
|
||||
foo({ x: ["string", 1], y: { c: true, d: "world", e: 3 } }); // Not error
|
||||
|
||||
var array = ["string", 1, true];
|
||||
var tuple: [string, number, boolean] = ["string", 1, true];
|
||||
baz(tuple);
|
||||
baz(["string", 1, true]);
|
||||
|
||||
baz(array); // Error
|
||||
~~~~~
|
||||
!!! error TS2345: Argument of type '(string | number | boolean)[]' is not assignable to parameter of type '[string, number, boolean]'.
|
||||
!!! error TS2345: Property '0' is missing in type '(string | number | boolean)[]'.
|
||||
baz(["string", 1, true, ...array]); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type '(string | number | boolean)[]' is not assignable to parameter of type '[string, number, boolean]'.
|
||||
foo(o); // Error because x has an array type namely (string|number)[]
|
||||
~
|
||||
!!! error TS2345: Argument of type '{ x: (string | number)[]; y: { c: boolean; d: string; e: number; }; }' is not assignable to parameter of type '{ x: [any, any]; y: { c: any; d: any; e: any; }; }'.
|
||||
!!! error TS2345: Types of property 'x' are incompatible.
|
||||
!!! error TS2345: Type '(string | number)[]' is not assignable to type '[any, any]'.
|
||||
!!! error TS2345: Property '0' is missing in type '(string | number)[]'.
|
||||
@@ -0,0 +1,40 @@
|
||||
//// [argumentExpressionContextualTyping.ts]
|
||||
// In a typed function call, argument expressions are contextually typed by their corresponding parameter types.
|
||||
function foo({x: [a, b], y: {c, d, e}}) { }
|
||||
function bar({x: [a, b = 10], y: {c, d, e = { f:1 }}}) { }
|
||||
function baz(x: [string, number, boolean]) { }
|
||||
|
||||
var o = { x: ["string", 1], y: { c: true, d: "world", e: 3 } };
|
||||
var o1: { x: [string, number], y: { c: boolean, d: string, e: number } } = { x: ["string", 1], y: { c: true, d: "world", e: 3 } };
|
||||
foo(o1); // Not error since x has contextual type of tuple namely [string, number]
|
||||
foo({ x: ["string", 1], y: { c: true, d: "world", e: 3 } }); // Not error
|
||||
|
||||
var array = ["string", 1, true];
|
||||
var tuple: [string, number, boolean] = ["string", 1, true];
|
||||
baz(tuple);
|
||||
baz(["string", 1, true]);
|
||||
|
||||
baz(array); // Error
|
||||
baz(["string", 1, true, ...array]); // Error
|
||||
foo(o); // Error because x has an array type namely (string|number)[]
|
||||
|
||||
//// [argumentExpressionContextualTyping.js]
|
||||
// In a typed function call, argument expressions are contextually typed by their corresponding parameter types.
|
||||
function foo(_a) {
|
||||
var _b = _a.x, a = _b[0], b = _b[1], _c = _a.y, c = _c.c, d = _c.d, e = _c.e;
|
||||
}
|
||||
function bar(_a) {
|
||||
var _b = _a.x, a = _b[0], _c = _b[1], b = _c === void 0 ? 10 : _c, _d = _a.y, c = _d.c, d = _d.d, _e = _d.e, e = _e === void 0 ? { f: 1 } : _e;
|
||||
}
|
||||
function baz(x) { }
|
||||
var o = { x: ["string", 1], y: { c: true, d: "world", e: 3 } };
|
||||
var o1 = { x: ["string", 1], y: { c: true, d: "world", e: 3 } };
|
||||
foo(o1); // Not error since x has contextual type of tuple namely [string, number]
|
||||
foo({ x: ["string", 1], y: { c: true, d: "world", e: 3 } }); // Not error
|
||||
var array = ["string", 1, true];
|
||||
var tuple = ["string", 1, true];
|
||||
baz(tuple);
|
||||
baz(["string", 1, true]);
|
||||
baz(array); // Error
|
||||
baz(["string", 1, true].concat(array)); // Error
|
||||
foo(o); // Error because x has an array type namely (string|number)[]
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user