Merge branch 'master' into reachabilityChecks

This commit is contained in:
Vladimir Matveev
2015-10-19 15:54:45 -07:00
78 changed files with 44712 additions and 40862 deletions
+36 -11
View File
@@ -1,17 +1,21 @@
## Contributing bug fixes
TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved ("Milestone == Community") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.
## Contributing features
Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved (marked as "Milestone == Community" by a TypeScript coordinator with the message "Approved") in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted.
Design changes will not be accepted at this time. If you have a design change proposal, please log a suggestion issue.
## Legal
You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright.
Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.docx](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=822190) or [Microsoft Contribution License Agreement.pdf](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=921298)), sign, scan, and email it back to <cla@microsoft.com>. Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request.
## Housekeeping
Your pull request should:
* Include a description of what your change intends to do
@@ -29,7 +33,8 @@ Your pull request should:
* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration
## Running the Tests
To run all tests, invoke the runtests target using jake:
To run all tests, invoke the `runtests` target using jake:
```Shell
jake runtests
@@ -47,23 +52,42 @@ e.g. to run all compiler baseline tests:
jake runtests tests=compiler
```
or to run specifc test: `tests\cases\compiler\2dArrays.ts`
or to run a specific test: `tests\cases\compiler\2dArrays.ts`
```Shell
jake runtests tests=2dArrays
```
## Debugging the tests
To debug the tests, invoke the `runtests-browser` task from jake.
You will probably only want to debug one test at a time:
```Shell
jake runtests-browser tests=2dArrays
```
You can specify which browser to use for debugging. Currently Chrome and IE are supported:
```Shell
jake runtests-browser tests=2dArrays browser=chrome
```
You can debug with VS Code or Node instead with `jake runtests debug=true`:
```Shell
jake runtests tests=2dArrays debug=true
```
## Adding a Test
To add a new testcase, simply place a `.ts` file in `tests\cases\compiler` containing code that exemplifies the bugfix or change you are making.
These files support metadata tags in the format `// @metaDataName: value`. The supported names and values are:
To add a new test case, simply place a `.ts` file in `tests\cases\compiler` containing code that exemplifies the bugfix or change you are making.
* `comments`, `sourcemap`, `noimplicitany`, `declaration`: true or false (corresponds to the compiler command-line options of the same name)
* `target`: ES3 or ES5 (same as compiler)
* `out`, outDir: path (same as compiler)
* `module`: local, commonjs, or amd (local corresponds to not passing any compiler --module flag)
* `fileName`: path
* These tags delimit sections of a file to be used as separate compilation units. They are useful for tests relating to modules. See below for examples.
These files support metadata tags in the format `// @metaDataName: value`.
The supported names and values are the same as those supported in the compiler itself, with the addition of the `fileName` flag.
`fileName` tags delimit sections of a file to be used as separate compilation units.
They are useful for tests relating to modules.
See below for examples.
**Note** that if you have a test corresponding to a specific spec compliance item, you can place it in `tests\cases\conformance` in an appropriately-named subfolder.
**Note** that filenames here must be distinct from all other compiler testcase names, so you may have to work a bit to find a unique name if it's something common.
@@ -86,6 +110,7 @@ var x = g();
One can also write a project test, but it is slightly more involved.
## Managing the Baselines
Compiler testcases generate baselines that track the emitted `.js`, the errors produced by the compiler, and the type of each expression in the file. Additionally, some testcases opt in to baselining the source map output.
When a change in the baselines is detected, the test will fail. To inspect changes vs the expected baselines, use
@@ -102,4 +127,4 @@ jake baseline-accept
to establish the new baselines as the desired behavior. This will change the files in `tests\baselines\reference`, which should be included as part of your commit. It's important to carefully validate changes in the baselines.
**Note** that baseline-accept should only be run after a full test run! Accepting baselines after running a subset of tests will delete baseline files for the tests that didn't run.
**Note** that `baseline-accept` should only be run after a full test run! Accepting baselines after running a subset of tests will delete baseline files for the tests that didn't run.
+28 -1
View File
@@ -3965,7 +3965,34 @@ interface ObjectConstructor {
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param sources One or more source objects to copy properties from.
* @param source The source object from which to copy properties.
*/
assign<T, U>(target: T, source: U): T & U;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param source1 The first source object from which to copy properties.
* @param source2 The second source object from which to copy properties.
*/
assign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param source1 The first source object from which to copy properties.
* @param source2 The second source object from which to copy properties.
* @param source3 The third source object from which to copy properties.
*/
assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param sources One or more source objects from which to copy properties
*/
assign(target: any, ...sources: any[]): any;
+27 -125
View File
@@ -4243,8 +4243,8 @@ interface AnalyserNode extends AudioNode {
smoothingTimeConstant: number;
getByteFrequencyData(array: Uint8Array): void;
getByteTimeDomainData(array: Uint8Array): void;
getFloatFrequencyData(array: any): void;
getFloatTimeDomainData(array: any): void;
getFloatFrequencyData(array: Float32Array): void;
getFloatTimeDomainData(array: Float32Array): void;
}
declare var AnalyserNode: {
@@ -4331,7 +4331,7 @@ interface AudioBuffer {
length: number;
numberOfChannels: number;
sampleRate: number;
getChannelData(channel: number): any;
getChannelData(channel: number): Float32Array;
}
declare var AudioBuffer: {
@@ -4375,7 +4375,7 @@ interface AudioContext extends EventTarget {
createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;
createOscillator(): OscillatorNode;
createPanner(): PannerNode;
createPeriodicWave(real: any, imag: any): PeriodicWave;
createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave;
createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;
createStereoPanner(): StereoPannerNode;
createWaveShaper(): WaveShaperNode;
@@ -4433,7 +4433,7 @@ interface AudioParam {
linearRampToValueAtTime(value: number, endTime: number): void;
setTargetAtTime(target: number, startTime: number, timeConstant: number): void;
setValueAtTime(value: number, startTime: number): void;
setValueCurveAtTime(values: any, startTime: number, duration: number): void;
setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;
}
declare var AudioParam: {
@@ -4509,7 +4509,7 @@ interface BiquadFilterNode extends AudioNode {
frequency: AudioParam;
gain: AudioParam;
type: string;
getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void;
getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;
}
declare var BiquadFilterNode: {
@@ -5108,7 +5108,7 @@ declare var CanvasPattern: {
interface CanvasRenderingContext2D {
canvas: HTMLCanvasElement;
fillStyle: any;
fillStyle: string | CanvasGradient | CanvasPattern;
font: string;
globalAlpha: number;
globalCompositeOperation: string;
@@ -5123,7 +5123,7 @@ interface CanvasRenderingContext2D {
shadowColor: string;
shadowOffsetX: number;
shadowOffsetY: number;
strokeStyle: any;
strokeStyle: string | CanvasGradient | CanvasPattern;
textAlign: string;
textBaseline: string;
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
@@ -6491,8 +6491,6 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
importNode(importedNode: Node, deep: boolean): Node;
msElementsFromPoint(x: number, y: number): NodeList;
msElementsFromRect(left: number, top: number, width: number, height: number): NodeList;
msGetPrintDocumentForNamedFlow(flowName: string): Document;
msSetPrintDocumentUriForNamedFlow(flowName: string, uri: string): void;
/**
* Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.
* @param url Specifies a MIME type for the document.
@@ -11314,27 +11312,6 @@ declare var MSHTMLWebViewElement: {
new(): MSHTMLWebViewElement;
}
interface MSHeaderFooter {
URL: string;
dateLong: string;
dateShort: string;
font: string;
htmlFoot: string;
htmlHead: string;
page: number;
pageTotal: number;
textFoot: string;
textHead: string;
timeLong: string;
timeShort: string;
title: string;
}
declare var MSHeaderFooter: {
prototype: MSHeaderFooter;
new(): MSHeaderFooter;
}
interface MSInputMethodContext extends EventTarget {
compositionEndOffset: number;
compositionStartOffset: number;
@@ -11493,24 +11470,6 @@ declare var MSPointerEvent: {
new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent;
}
interface MSPrintManagerTemplatePrinter extends MSTemplatePrinter, EventTarget {
percentScale: number;
showHeaderFooter: boolean;
shrinkToFit: boolean;
drawPreviewPage(element: HTMLElement, pageNumber: number): void;
endPrint(): void;
getPrintTaskOptionValue(key: string): any;
invalidatePreview(): void;
setPageCount(pageCount: number): void;
startPrint(): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var MSPrintManagerTemplatePrinter: {
prototype: MSPrintManagerTemplatePrinter;
new(): MSPrintManagerTemplatePrinter;
}
interface MSRangeCollection {
length: number;
item(index: number): Range;
@@ -11558,63 +11517,6 @@ declare var MSStreamReader: {
new(): MSStreamReader;
}
interface MSTemplatePrinter {
collate: boolean;
copies: number;
currentPage: boolean;
currentPageAvail: boolean;
duplex: boolean;
footer: string;
frameActive: boolean;
frameActiveEnabled: boolean;
frameAsShown: boolean;
framesetDocument: boolean;
header: string;
headerFooterFont: string;
marginBottom: number;
marginLeft: number;
marginRight: number;
marginTop: number;
orientation: string;
pageFrom: number;
pageHeight: number;
pageTo: number;
pageWidth: number;
selectedPages: boolean;
selection: boolean;
selectionEnabled: boolean;
unprintableBottom: number;
unprintableLeft: number;
unprintableRight: number;
unprintableTop: number;
usePrinterCopyCollate: boolean;
createHeaderFooter(): MSHeaderFooter;
deviceSupports(property: string): any;
ensurePrintDialogDefaults(): boolean;
getPageMarginBottom(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginBottomImportant(pageRule: CSSPageRule): boolean;
getPageMarginLeft(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginLeftImportant(pageRule: CSSPageRule): boolean;
getPageMarginRight(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginRightImportant(pageRule: CSSPageRule): boolean;
getPageMarginTop(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginTopImportant(pageRule: CSSPageRule): boolean;
printBlankPage(): void;
printNonNative(document: any): boolean;
printNonNativeFrames(document: any, activeFrame: boolean): void;
printPage(element: HTMLElement): void;
showPageSetupDialog(): boolean;
showPrintDialog(): boolean;
startDoc(title: string): boolean;
stopDoc(): void;
updatePageStatus(status: number): void;
}
declare var MSTemplatePrinter: {
prototype: MSTemplatePrinter;
new(): MSTemplatePrinter;
}
interface MSWebViewAsyncOperation extends EventTarget {
error: DOMError;
oncomplete: (ev: Event) => any;
@@ -12032,6 +11934,10 @@ declare var Node: {
}
interface NodeFilter {
acceptNode(n: Node): number;
}
declare var NodeFilter: {
FILTER_ACCEPT: number;
FILTER_REJECT: number;
FILTER_SKIP: number;
@@ -12049,7 +11955,6 @@ interface NodeFilter {
SHOW_PROCESSING_INSTRUCTION: number;
SHOW_TEXT: number;
}
declare var NodeFilter: NodeFilter;
interface NodeIterator {
expandEntityReferences: boolean;
@@ -12759,7 +12664,6 @@ declare var SVGDescElement: {
interface SVGElement extends Element {
id: string;
className: any;
onclick: (ev: MouseEvent) => any;
ondblclick: (ev: MouseEvent) => any;
onfocusin: (ev: FocusEvent) => any;
@@ -12773,6 +12677,7 @@ interface SVGElement extends Element {
ownerSVGElement: SVGSVGElement;
viewportElement: SVGElement;
xmlbase: string;
className: any;
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -14934,7 +14839,7 @@ declare var WEBGL_depth_texture: {
}
interface WaveShaperNode extends AudioNode {
curve: any;
curve: Float32Array;
oversample: string;
}
@@ -15121,34 +15026,34 @@ interface WebGLRenderingContext {
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void;
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void;
uniform1f(location: WebGLUniformLocation, x: number): void;
uniform1fv(location: WebGLUniformLocation, v: any): void;
uniform1fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform1i(location: WebGLUniformLocation, x: number): void;
uniform1iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform2f(location: WebGLUniformLocation, x: number, y: number): void;
uniform2fv(location: WebGLUniformLocation, v: any): void;
uniform2fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform2i(location: WebGLUniformLocation, x: number, y: number): void;
uniform2iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void;
uniform3fv(location: WebGLUniformLocation, v: any): void;
uniform3fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void;
uniform3iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
uniform4fv(location: WebGLUniformLocation, v: any): void;
uniform4fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
uniform4iv(location: WebGLUniformLocation, v: Int32Array): void;
uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
useProgram(program: WebGLProgram): void;
validateProgram(program: WebGLProgram): void;
vertexAttrib1f(indx: number, x: number): void;
vertexAttrib1fv(indx: number, values: any): void;
vertexAttrib1fv(indx: number, values: Float32Array): void;
vertexAttrib2f(indx: number, x: number, y: number): void;
vertexAttrib2fv(indx: number, values: any): void;
vertexAttrib2fv(indx: number, values: Float32Array): void;
vertexAttrib3f(indx: number, x: number, y: number, z: number): void;
vertexAttrib3fv(indx: number, values: any): void;
vertexAttrib3fv(indx: number, values: Float32Array): void;
vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void;
vertexAttrib4fv(indx: number, values: any): void;
vertexAttrib4fv(indx: number, values: Float32Array): void;
vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void;
viewport(x: number, y: number, width: number, height: number): void;
ACTIVE_ATTRIBUTES: number;
@@ -15912,7 +15817,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
locationbar: BarProp;
menubar: BarProp;
msAnimationStartTime: number;
msTemplatePrinter: MSTemplatePrinter;
name: string;
navigator: Navigator;
offscreenBuffering: string | boolean;
@@ -16649,7 +16553,6 @@ interface XMLHttpRequestEventTarget {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
interface NodeListOf<TNode extends Node> extends NodeList {
length: number;
item(index: number): TNode;
@@ -16670,8 +16573,6 @@ interface EventListenerObject {
handleEvent(evt: Event): void;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface MessageEventInit extends EventInit {
data?: any;
origin?: string;
@@ -16687,6 +16588,8 @@ interface ProgressEventInit extends EventInit {
total?: number;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
}
@@ -16747,7 +16650,6 @@ declare var location: Location;
declare var locationbar: BarProp;
declare var menubar: BarProp;
declare var msAnimationStartTime: number;
declare var msTemplatePrinter: MSTemplatePrinter;
declare var name: string;
declare var navigator: Navigator;
declare var offscreenBuffering: string | boolean;
+27 -125
View File
@@ -419,8 +419,8 @@ interface AnalyserNode extends AudioNode {
smoothingTimeConstant: number;
getByteFrequencyData(array: Uint8Array): void;
getByteTimeDomainData(array: Uint8Array): void;
getFloatFrequencyData(array: any): void;
getFloatTimeDomainData(array: any): void;
getFloatFrequencyData(array: Float32Array): void;
getFloatTimeDomainData(array: Float32Array): void;
}
declare var AnalyserNode: {
@@ -507,7 +507,7 @@ interface AudioBuffer {
length: number;
numberOfChannels: number;
sampleRate: number;
getChannelData(channel: number): any;
getChannelData(channel: number): Float32Array;
}
declare var AudioBuffer: {
@@ -551,7 +551,7 @@ interface AudioContext extends EventTarget {
createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;
createOscillator(): OscillatorNode;
createPanner(): PannerNode;
createPeriodicWave(real: any, imag: any): PeriodicWave;
createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave;
createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;
createStereoPanner(): StereoPannerNode;
createWaveShaper(): WaveShaperNode;
@@ -609,7 +609,7 @@ interface AudioParam {
linearRampToValueAtTime(value: number, endTime: number): void;
setTargetAtTime(target: number, startTime: number, timeConstant: number): void;
setValueAtTime(value: number, startTime: number): void;
setValueCurveAtTime(values: any, startTime: number, duration: number): void;
setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;
}
declare var AudioParam: {
@@ -685,7 +685,7 @@ interface BiquadFilterNode extends AudioNode {
frequency: AudioParam;
gain: AudioParam;
type: string;
getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void;
getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;
}
declare var BiquadFilterNode: {
@@ -1284,7 +1284,7 @@ declare var CanvasPattern: {
interface CanvasRenderingContext2D {
canvas: HTMLCanvasElement;
fillStyle: any;
fillStyle: string | CanvasGradient | CanvasPattern;
font: string;
globalAlpha: number;
globalCompositeOperation: string;
@@ -1299,7 +1299,7 @@ interface CanvasRenderingContext2D {
shadowColor: string;
shadowOffsetX: number;
shadowOffsetY: number;
strokeStyle: any;
strokeStyle: string | CanvasGradient | CanvasPattern;
textAlign: string;
textBaseline: string;
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
@@ -2667,8 +2667,6 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
importNode(importedNode: Node, deep: boolean): Node;
msElementsFromPoint(x: number, y: number): NodeList;
msElementsFromRect(left: number, top: number, width: number, height: number): NodeList;
msGetPrintDocumentForNamedFlow(flowName: string): Document;
msSetPrintDocumentUriForNamedFlow(flowName: string, uri: string): void;
/**
* Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.
* @param url Specifies a MIME type for the document.
@@ -7490,27 +7488,6 @@ declare var MSHTMLWebViewElement: {
new(): MSHTMLWebViewElement;
}
interface MSHeaderFooter {
URL: string;
dateLong: string;
dateShort: string;
font: string;
htmlFoot: string;
htmlHead: string;
page: number;
pageTotal: number;
textFoot: string;
textHead: string;
timeLong: string;
timeShort: string;
title: string;
}
declare var MSHeaderFooter: {
prototype: MSHeaderFooter;
new(): MSHeaderFooter;
}
interface MSInputMethodContext extends EventTarget {
compositionEndOffset: number;
compositionStartOffset: number;
@@ -7669,24 +7646,6 @@ declare var MSPointerEvent: {
new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent;
}
interface MSPrintManagerTemplatePrinter extends MSTemplatePrinter, EventTarget {
percentScale: number;
showHeaderFooter: boolean;
shrinkToFit: boolean;
drawPreviewPage(element: HTMLElement, pageNumber: number): void;
endPrint(): void;
getPrintTaskOptionValue(key: string): any;
invalidatePreview(): void;
setPageCount(pageCount: number): void;
startPrint(): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var MSPrintManagerTemplatePrinter: {
prototype: MSPrintManagerTemplatePrinter;
new(): MSPrintManagerTemplatePrinter;
}
interface MSRangeCollection {
length: number;
item(index: number): Range;
@@ -7734,63 +7693,6 @@ declare var MSStreamReader: {
new(): MSStreamReader;
}
interface MSTemplatePrinter {
collate: boolean;
copies: number;
currentPage: boolean;
currentPageAvail: boolean;
duplex: boolean;
footer: string;
frameActive: boolean;
frameActiveEnabled: boolean;
frameAsShown: boolean;
framesetDocument: boolean;
header: string;
headerFooterFont: string;
marginBottom: number;
marginLeft: number;
marginRight: number;
marginTop: number;
orientation: string;
pageFrom: number;
pageHeight: number;
pageTo: number;
pageWidth: number;
selectedPages: boolean;
selection: boolean;
selectionEnabled: boolean;
unprintableBottom: number;
unprintableLeft: number;
unprintableRight: number;
unprintableTop: number;
usePrinterCopyCollate: boolean;
createHeaderFooter(): MSHeaderFooter;
deviceSupports(property: string): any;
ensurePrintDialogDefaults(): boolean;
getPageMarginBottom(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginBottomImportant(pageRule: CSSPageRule): boolean;
getPageMarginLeft(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginLeftImportant(pageRule: CSSPageRule): boolean;
getPageMarginRight(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginRightImportant(pageRule: CSSPageRule): boolean;
getPageMarginTop(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginTopImportant(pageRule: CSSPageRule): boolean;
printBlankPage(): void;
printNonNative(document: any): boolean;
printNonNativeFrames(document: any, activeFrame: boolean): void;
printPage(element: HTMLElement): void;
showPageSetupDialog(): boolean;
showPrintDialog(): boolean;
startDoc(title: string): boolean;
stopDoc(): void;
updatePageStatus(status: number): void;
}
declare var MSTemplatePrinter: {
prototype: MSTemplatePrinter;
new(): MSTemplatePrinter;
}
interface MSWebViewAsyncOperation extends EventTarget {
error: DOMError;
oncomplete: (ev: Event) => any;
@@ -8208,6 +8110,10 @@ declare var Node: {
}
interface NodeFilter {
acceptNode(n: Node): number;
}
declare var NodeFilter: {
FILTER_ACCEPT: number;
FILTER_REJECT: number;
FILTER_SKIP: number;
@@ -8225,7 +8131,6 @@ interface NodeFilter {
SHOW_PROCESSING_INSTRUCTION: number;
SHOW_TEXT: number;
}
declare var NodeFilter: NodeFilter;
interface NodeIterator {
expandEntityReferences: boolean;
@@ -8935,7 +8840,6 @@ declare var SVGDescElement: {
interface SVGElement extends Element {
id: string;
className: any;
onclick: (ev: MouseEvent) => any;
ondblclick: (ev: MouseEvent) => any;
onfocusin: (ev: FocusEvent) => any;
@@ -8949,6 +8853,7 @@ interface SVGElement extends Element {
ownerSVGElement: SVGSVGElement;
viewportElement: SVGElement;
xmlbase: string;
className: any;
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -11110,7 +11015,7 @@ declare var WEBGL_depth_texture: {
}
interface WaveShaperNode extends AudioNode {
curve: any;
curve: Float32Array;
oversample: string;
}
@@ -11297,34 +11202,34 @@ interface WebGLRenderingContext {
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void;
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void;
uniform1f(location: WebGLUniformLocation, x: number): void;
uniform1fv(location: WebGLUniformLocation, v: any): void;
uniform1fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform1i(location: WebGLUniformLocation, x: number): void;
uniform1iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform2f(location: WebGLUniformLocation, x: number, y: number): void;
uniform2fv(location: WebGLUniformLocation, v: any): void;
uniform2fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform2i(location: WebGLUniformLocation, x: number, y: number): void;
uniform2iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void;
uniform3fv(location: WebGLUniformLocation, v: any): void;
uniform3fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void;
uniform3iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
uniform4fv(location: WebGLUniformLocation, v: any): void;
uniform4fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
uniform4iv(location: WebGLUniformLocation, v: Int32Array): void;
uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
useProgram(program: WebGLProgram): void;
validateProgram(program: WebGLProgram): void;
vertexAttrib1f(indx: number, x: number): void;
vertexAttrib1fv(indx: number, values: any): void;
vertexAttrib1fv(indx: number, values: Float32Array): void;
vertexAttrib2f(indx: number, x: number, y: number): void;
vertexAttrib2fv(indx: number, values: any): void;
vertexAttrib2fv(indx: number, values: Float32Array): void;
vertexAttrib3f(indx: number, x: number, y: number, z: number): void;
vertexAttrib3fv(indx: number, values: any): void;
vertexAttrib3fv(indx: number, values: Float32Array): void;
vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void;
vertexAttrib4fv(indx: number, values: any): void;
vertexAttrib4fv(indx: number, values: Float32Array): void;
vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void;
viewport(x: number, y: number, width: number, height: number): void;
ACTIVE_ATTRIBUTES: number;
@@ -12088,7 +11993,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
locationbar: BarProp;
menubar: BarProp;
msAnimationStartTime: number;
msTemplatePrinter: MSTemplatePrinter;
name: string;
navigator: Navigator;
offscreenBuffering: string | boolean;
@@ -12825,7 +12729,6 @@ interface XMLHttpRequestEventTarget {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
interface NodeListOf<TNode extends Node> extends NodeList {
length: number;
item(index: number): TNode;
@@ -12846,8 +12749,6 @@ interface EventListenerObject {
handleEvent(evt: Event): void;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface MessageEventInit extends EventInit {
data?: any;
origin?: string;
@@ -12863,6 +12764,8 @@ interface ProgressEventInit extends EventInit {
total?: number;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
}
@@ -12923,7 +12826,6 @@ declare var location: Location;
declare var locationbar: BarProp;
declare var menubar: BarProp;
declare var msAnimationStartTime: number;
declare var msTemplatePrinter: MSTemplatePrinter;
declare var name: string;
declare var navigator: Navigator;
declare var offscreenBuffering: string | boolean;
+27 -125
View File
@@ -5558,8 +5558,8 @@ interface AnalyserNode extends AudioNode {
smoothingTimeConstant: number;
getByteFrequencyData(array: Uint8Array): void;
getByteTimeDomainData(array: Uint8Array): void;
getFloatFrequencyData(array: any): void;
getFloatTimeDomainData(array: any): void;
getFloatFrequencyData(array: Float32Array): void;
getFloatTimeDomainData(array: Float32Array): void;
}
declare var AnalyserNode: {
@@ -5646,7 +5646,7 @@ interface AudioBuffer {
length: number;
numberOfChannels: number;
sampleRate: number;
getChannelData(channel: number): any;
getChannelData(channel: number): Float32Array;
}
declare var AudioBuffer: {
@@ -5690,7 +5690,7 @@ interface AudioContext extends EventTarget {
createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;
createOscillator(): OscillatorNode;
createPanner(): PannerNode;
createPeriodicWave(real: any, imag: any): PeriodicWave;
createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave;
createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;
createStereoPanner(): StereoPannerNode;
createWaveShaper(): WaveShaperNode;
@@ -5748,7 +5748,7 @@ interface AudioParam {
linearRampToValueAtTime(value: number, endTime: number): void;
setTargetAtTime(target: number, startTime: number, timeConstant: number): void;
setValueAtTime(value: number, startTime: number): void;
setValueCurveAtTime(values: any, startTime: number, duration: number): void;
setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;
}
declare var AudioParam: {
@@ -5824,7 +5824,7 @@ interface BiquadFilterNode extends AudioNode {
frequency: AudioParam;
gain: AudioParam;
type: string;
getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void;
getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;
}
declare var BiquadFilterNode: {
@@ -6423,7 +6423,7 @@ declare var CanvasPattern: {
interface CanvasRenderingContext2D {
canvas: HTMLCanvasElement;
fillStyle: any;
fillStyle: string | CanvasGradient | CanvasPattern;
font: string;
globalAlpha: number;
globalCompositeOperation: string;
@@ -6438,7 +6438,7 @@ interface CanvasRenderingContext2D {
shadowColor: string;
shadowOffsetX: number;
shadowOffsetY: number;
strokeStyle: any;
strokeStyle: string | CanvasGradient | CanvasPattern;
textAlign: string;
textBaseline: string;
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
@@ -7806,8 +7806,6 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
importNode(importedNode: Node, deep: boolean): Node;
msElementsFromPoint(x: number, y: number): NodeList;
msElementsFromRect(left: number, top: number, width: number, height: number): NodeList;
msGetPrintDocumentForNamedFlow(flowName: string): Document;
msSetPrintDocumentUriForNamedFlow(flowName: string, uri: string): void;
/**
* Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.
* @param url Specifies a MIME type for the document.
@@ -12629,27 +12627,6 @@ declare var MSHTMLWebViewElement: {
new(): MSHTMLWebViewElement;
}
interface MSHeaderFooter {
URL: string;
dateLong: string;
dateShort: string;
font: string;
htmlFoot: string;
htmlHead: string;
page: number;
pageTotal: number;
textFoot: string;
textHead: string;
timeLong: string;
timeShort: string;
title: string;
}
declare var MSHeaderFooter: {
prototype: MSHeaderFooter;
new(): MSHeaderFooter;
}
interface MSInputMethodContext extends EventTarget {
compositionEndOffset: number;
compositionStartOffset: number;
@@ -12808,24 +12785,6 @@ declare var MSPointerEvent: {
new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent;
}
interface MSPrintManagerTemplatePrinter extends MSTemplatePrinter, EventTarget {
percentScale: number;
showHeaderFooter: boolean;
shrinkToFit: boolean;
drawPreviewPage(element: HTMLElement, pageNumber: number): void;
endPrint(): void;
getPrintTaskOptionValue(key: string): any;
invalidatePreview(): void;
setPageCount(pageCount: number): void;
startPrint(): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
declare var MSPrintManagerTemplatePrinter: {
prototype: MSPrintManagerTemplatePrinter;
new(): MSPrintManagerTemplatePrinter;
}
interface MSRangeCollection {
length: number;
item(index: number): Range;
@@ -12873,63 +12832,6 @@ declare var MSStreamReader: {
new(): MSStreamReader;
}
interface MSTemplatePrinter {
collate: boolean;
copies: number;
currentPage: boolean;
currentPageAvail: boolean;
duplex: boolean;
footer: string;
frameActive: boolean;
frameActiveEnabled: boolean;
frameAsShown: boolean;
framesetDocument: boolean;
header: string;
headerFooterFont: string;
marginBottom: number;
marginLeft: number;
marginRight: number;
marginTop: number;
orientation: string;
pageFrom: number;
pageHeight: number;
pageTo: number;
pageWidth: number;
selectedPages: boolean;
selection: boolean;
selectionEnabled: boolean;
unprintableBottom: number;
unprintableLeft: number;
unprintableRight: number;
unprintableTop: number;
usePrinterCopyCollate: boolean;
createHeaderFooter(): MSHeaderFooter;
deviceSupports(property: string): any;
ensurePrintDialogDefaults(): boolean;
getPageMarginBottom(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginBottomImportant(pageRule: CSSPageRule): boolean;
getPageMarginLeft(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginLeftImportant(pageRule: CSSPageRule): boolean;
getPageMarginRight(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginRightImportant(pageRule: CSSPageRule): boolean;
getPageMarginTop(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
getPageMarginTopImportant(pageRule: CSSPageRule): boolean;
printBlankPage(): void;
printNonNative(document: any): boolean;
printNonNativeFrames(document: any, activeFrame: boolean): void;
printPage(element: HTMLElement): void;
showPageSetupDialog(): boolean;
showPrintDialog(): boolean;
startDoc(title: string): boolean;
stopDoc(): void;
updatePageStatus(status: number): void;
}
declare var MSTemplatePrinter: {
prototype: MSTemplatePrinter;
new(): MSTemplatePrinter;
}
interface MSWebViewAsyncOperation extends EventTarget {
error: DOMError;
oncomplete: (ev: Event) => any;
@@ -13347,6 +13249,10 @@ declare var Node: {
}
interface NodeFilter {
acceptNode(n: Node): number;
}
declare var NodeFilter: {
FILTER_ACCEPT: number;
FILTER_REJECT: number;
FILTER_SKIP: number;
@@ -13364,7 +13270,6 @@ interface NodeFilter {
SHOW_PROCESSING_INSTRUCTION: number;
SHOW_TEXT: number;
}
declare var NodeFilter: NodeFilter;
interface NodeIterator {
expandEntityReferences: boolean;
@@ -14074,7 +13979,6 @@ declare var SVGDescElement: {
interface SVGElement extends Element {
id: string;
className: any;
onclick: (ev: MouseEvent) => any;
ondblclick: (ev: MouseEvent) => any;
onfocusin: (ev: FocusEvent) => any;
@@ -14088,6 +13992,7 @@ interface SVGElement extends Element {
ownerSVGElement: SVGSVGElement;
viewportElement: SVGElement;
xmlbase: string;
className: any;
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
@@ -16249,7 +16154,7 @@ declare var WEBGL_depth_texture: {
}
interface WaveShaperNode extends AudioNode {
curve: any;
curve: Float32Array;
oversample: string;
}
@@ -16436,34 +16341,34 @@ interface WebGLRenderingContext {
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void;
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void;
uniform1f(location: WebGLUniformLocation, x: number): void;
uniform1fv(location: WebGLUniformLocation, v: any): void;
uniform1fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform1i(location: WebGLUniformLocation, x: number): void;
uniform1iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform2f(location: WebGLUniformLocation, x: number, y: number): void;
uniform2fv(location: WebGLUniformLocation, v: any): void;
uniform2fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform2i(location: WebGLUniformLocation, x: number, y: number): void;
uniform2iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void;
uniform3fv(location: WebGLUniformLocation, v: any): void;
uniform3fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void;
uniform3iv(location: WebGLUniformLocation, v: Int32Array): void;
uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
uniform4fv(location: WebGLUniformLocation, v: any): void;
uniform4fv(location: WebGLUniformLocation, v: Float32Array): void;
uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
uniform4iv(location: WebGLUniformLocation, v: Int32Array): void;
uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
useProgram(program: WebGLProgram): void;
validateProgram(program: WebGLProgram): void;
vertexAttrib1f(indx: number, x: number): void;
vertexAttrib1fv(indx: number, values: any): void;
vertexAttrib1fv(indx: number, values: Float32Array): void;
vertexAttrib2f(indx: number, x: number, y: number): void;
vertexAttrib2fv(indx: number, values: any): void;
vertexAttrib2fv(indx: number, values: Float32Array): void;
vertexAttrib3f(indx: number, x: number, y: number, z: number): void;
vertexAttrib3fv(indx: number, values: any): void;
vertexAttrib3fv(indx: number, values: Float32Array): void;
vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void;
vertexAttrib4fv(indx: number, values: any): void;
vertexAttrib4fv(indx: number, values: Float32Array): void;
vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void;
viewport(x: number, y: number, width: number, height: number): void;
ACTIVE_ATTRIBUTES: number;
@@ -17227,7 +17132,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
locationbar: BarProp;
menubar: BarProp;
msAnimationStartTime: number;
msTemplatePrinter: MSTemplatePrinter;
name: string;
navigator: Navigator;
offscreenBuffering: string | boolean;
@@ -17964,7 +17868,6 @@ interface XMLHttpRequestEventTarget {
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
}
interface NodeListOf<TNode extends Node> extends NodeList {
length: number;
item(index: number): TNode;
@@ -17985,8 +17888,6 @@ interface EventListenerObject {
handleEvent(evt: Event): void;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface MessageEventInit extends EventInit {
data?: any;
origin?: string;
@@ -18002,6 +17903,8 @@ interface ProgressEventInit extends EventInit {
total?: number;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
}
@@ -18062,7 +17965,6 @@ declare var location: Location;
declare var locationbar: BarProp;
declare var menubar: BarProp;
declare var msAnimationStartTime: number;
declare var msTemplatePrinter: MSTemplatePrinter;
declare var name: string;
declare var navigator: Navigator;
declare var offscreenBuffering: string | boolean;
+3 -4
View File
@@ -234,7 +234,7 @@ interface AudioBuffer {
length: number;
numberOfChannels: number;
sampleRate: number;
getChannelData(channel: number): any;
getChannelData(channel: number): Float32Array;
}
declare var AudioBuffer: {
@@ -1111,7 +1111,6 @@ interface WorkerUtils extends Object, WindowBase64 {
setTimeout(handler: any, timeout?: any, ...args: any[]): number;
}
interface BlobPropertyBag {
type?: string;
endings?: string;
@@ -1126,8 +1125,6 @@ interface EventListenerObject {
handleEvent(evt: Event): void;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface MessageEventInit extends EventInit {
data?: any;
origin?: string;
@@ -1143,6 +1140,8 @@ interface ProgressEventInit extends EventInit {
total?: number;
}
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
interface ErrorEventHandler {
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
}
+8884 -8314
View File
File diff suppressed because it is too large Load Diff
+10198 -9516
View File
File diff suppressed because it is too large Load Diff
+275 -254
View File
@@ -68,253 +68,255 @@ declare namespace ts {
PlusToken = 35,
MinusToken = 36,
AsteriskToken = 37,
SlashToken = 38,
PercentToken = 39,
PlusPlusToken = 40,
MinusMinusToken = 41,
LessThanLessThanToken = 42,
GreaterThanGreaterThanToken = 43,
GreaterThanGreaterThanGreaterThanToken = 44,
AmpersandToken = 45,
BarToken = 46,
CaretToken = 47,
ExclamationToken = 48,
TildeToken = 49,
AmpersandAmpersandToken = 50,
BarBarToken = 51,
QuestionToken = 52,
ColonToken = 53,
AtToken = 54,
EqualsToken = 55,
PlusEqualsToken = 56,
MinusEqualsToken = 57,
AsteriskEqualsToken = 58,
SlashEqualsToken = 59,
PercentEqualsToken = 60,
LessThanLessThanEqualsToken = 61,
GreaterThanGreaterThanEqualsToken = 62,
GreaterThanGreaterThanGreaterThanEqualsToken = 63,
AmpersandEqualsToken = 64,
BarEqualsToken = 65,
CaretEqualsToken = 66,
Identifier = 67,
BreakKeyword = 68,
CaseKeyword = 69,
CatchKeyword = 70,
ClassKeyword = 71,
ConstKeyword = 72,
ContinueKeyword = 73,
DebuggerKeyword = 74,
DefaultKeyword = 75,
DeleteKeyword = 76,
DoKeyword = 77,
ElseKeyword = 78,
EnumKeyword = 79,
ExportKeyword = 80,
ExtendsKeyword = 81,
FalseKeyword = 82,
FinallyKeyword = 83,
ForKeyword = 84,
FunctionKeyword = 85,
IfKeyword = 86,
ImportKeyword = 87,
InKeyword = 88,
InstanceOfKeyword = 89,
NewKeyword = 90,
NullKeyword = 91,
ReturnKeyword = 92,
SuperKeyword = 93,
SwitchKeyword = 94,
ThisKeyword = 95,
ThrowKeyword = 96,
TrueKeyword = 97,
TryKeyword = 98,
TypeOfKeyword = 99,
VarKeyword = 100,
VoidKeyword = 101,
WhileKeyword = 102,
WithKeyword = 103,
ImplementsKeyword = 104,
InterfaceKeyword = 105,
LetKeyword = 106,
PackageKeyword = 107,
PrivateKeyword = 108,
ProtectedKeyword = 109,
PublicKeyword = 110,
StaticKeyword = 111,
YieldKeyword = 112,
AbstractKeyword = 113,
AsKeyword = 114,
AnyKeyword = 115,
AsyncKeyword = 116,
AwaitKeyword = 117,
BooleanKeyword = 118,
ConstructorKeyword = 119,
DeclareKeyword = 120,
GetKeyword = 121,
IsKeyword = 122,
ModuleKeyword = 123,
NamespaceKeyword = 124,
RequireKeyword = 125,
NumberKeyword = 126,
SetKeyword = 127,
StringKeyword = 128,
SymbolKeyword = 129,
TypeKeyword = 130,
FromKeyword = 131,
OfKeyword = 132,
QualifiedName = 133,
ComputedPropertyName = 134,
TypeParameter = 135,
Parameter = 136,
Decorator = 137,
PropertySignature = 138,
PropertyDeclaration = 139,
MethodSignature = 140,
MethodDeclaration = 141,
Constructor = 142,
GetAccessor = 143,
SetAccessor = 144,
CallSignature = 145,
ConstructSignature = 146,
IndexSignature = 147,
TypePredicate = 148,
TypeReference = 149,
FunctionType = 150,
ConstructorType = 151,
TypeQuery = 152,
TypeLiteral = 153,
ArrayType = 154,
TupleType = 155,
UnionType = 156,
IntersectionType = 157,
ParenthesizedType = 158,
ObjectBindingPattern = 159,
ArrayBindingPattern = 160,
BindingElement = 161,
ArrayLiteralExpression = 162,
ObjectLiteralExpression = 163,
PropertyAccessExpression = 164,
ElementAccessExpression = 165,
CallExpression = 166,
NewExpression = 167,
TaggedTemplateExpression = 168,
TypeAssertionExpression = 169,
ParenthesizedExpression = 170,
FunctionExpression = 171,
ArrowFunction = 172,
DeleteExpression = 173,
TypeOfExpression = 174,
VoidExpression = 175,
AwaitExpression = 176,
PrefixUnaryExpression = 177,
PostfixUnaryExpression = 178,
BinaryExpression = 179,
ConditionalExpression = 180,
TemplateExpression = 181,
YieldExpression = 182,
SpreadElementExpression = 183,
ClassExpression = 184,
OmittedExpression = 185,
ExpressionWithTypeArguments = 186,
AsExpression = 187,
TemplateSpan = 188,
SemicolonClassElement = 189,
Block = 190,
VariableStatement = 191,
EmptyStatement = 192,
ExpressionStatement = 193,
IfStatement = 194,
DoStatement = 195,
WhileStatement = 196,
ForStatement = 197,
ForInStatement = 198,
ForOfStatement = 199,
ContinueStatement = 200,
BreakStatement = 201,
ReturnStatement = 202,
WithStatement = 203,
SwitchStatement = 204,
LabeledStatement = 205,
ThrowStatement = 206,
TryStatement = 207,
DebuggerStatement = 208,
VariableDeclaration = 209,
VariableDeclarationList = 210,
FunctionDeclaration = 211,
ClassDeclaration = 212,
InterfaceDeclaration = 213,
TypeAliasDeclaration = 214,
EnumDeclaration = 215,
ModuleDeclaration = 216,
ModuleBlock = 217,
CaseBlock = 218,
ImportEqualsDeclaration = 219,
ImportDeclaration = 220,
ImportClause = 221,
NamespaceImport = 222,
NamedImports = 223,
ImportSpecifier = 224,
ExportAssignment = 225,
ExportDeclaration = 226,
NamedExports = 227,
ExportSpecifier = 228,
MissingDeclaration = 229,
ExternalModuleReference = 230,
JsxElement = 231,
JsxSelfClosingElement = 232,
JsxOpeningElement = 233,
JsxText = 234,
JsxClosingElement = 235,
JsxAttribute = 236,
JsxSpreadAttribute = 237,
JsxExpression = 238,
CaseClause = 239,
DefaultClause = 240,
HeritageClause = 241,
CatchClause = 242,
PropertyAssignment = 243,
ShorthandPropertyAssignment = 244,
EnumMember = 245,
SourceFile = 246,
JSDocTypeExpression = 247,
JSDocAllType = 248,
JSDocUnknownType = 249,
JSDocArrayType = 250,
JSDocUnionType = 251,
JSDocTupleType = 252,
JSDocNullableType = 253,
JSDocNonNullableType = 254,
JSDocRecordType = 255,
JSDocRecordMember = 256,
JSDocTypeReference = 257,
JSDocOptionalType = 258,
JSDocFunctionType = 259,
JSDocVariadicType = 260,
JSDocConstructorType = 261,
JSDocThisType = 262,
JSDocComment = 263,
JSDocTag = 264,
JSDocParameterTag = 265,
JSDocReturnTag = 266,
JSDocTypeTag = 267,
JSDocTemplateTag = 268,
SyntaxList = 269,
Count = 270,
FirstAssignment = 55,
LastAssignment = 66,
FirstReservedWord = 68,
LastReservedWord = 103,
FirstKeyword = 68,
LastKeyword = 132,
FirstFutureReservedWord = 104,
LastFutureReservedWord = 112,
FirstTypeNode = 149,
LastTypeNode = 158,
AsteriskAsteriskToken = 38,
SlashToken = 39,
PercentToken = 40,
PlusPlusToken = 41,
MinusMinusToken = 42,
LessThanLessThanToken = 43,
GreaterThanGreaterThanToken = 44,
GreaterThanGreaterThanGreaterThanToken = 45,
AmpersandToken = 46,
BarToken = 47,
CaretToken = 48,
ExclamationToken = 49,
TildeToken = 50,
AmpersandAmpersandToken = 51,
BarBarToken = 52,
QuestionToken = 53,
ColonToken = 54,
AtToken = 55,
EqualsToken = 56,
PlusEqualsToken = 57,
MinusEqualsToken = 58,
AsteriskEqualsToken = 59,
AsteriskAsteriskEqualsToken = 60,
SlashEqualsToken = 61,
PercentEqualsToken = 62,
LessThanLessThanEqualsToken = 63,
GreaterThanGreaterThanEqualsToken = 64,
GreaterThanGreaterThanGreaterThanEqualsToken = 65,
AmpersandEqualsToken = 66,
BarEqualsToken = 67,
CaretEqualsToken = 68,
Identifier = 69,
BreakKeyword = 70,
CaseKeyword = 71,
CatchKeyword = 72,
ClassKeyword = 73,
ConstKeyword = 74,
ContinueKeyword = 75,
DebuggerKeyword = 76,
DefaultKeyword = 77,
DeleteKeyword = 78,
DoKeyword = 79,
ElseKeyword = 80,
EnumKeyword = 81,
ExportKeyword = 82,
ExtendsKeyword = 83,
FalseKeyword = 84,
FinallyKeyword = 85,
ForKeyword = 86,
FunctionKeyword = 87,
IfKeyword = 88,
ImportKeyword = 89,
InKeyword = 90,
InstanceOfKeyword = 91,
NewKeyword = 92,
NullKeyword = 93,
ReturnKeyword = 94,
SuperKeyword = 95,
SwitchKeyword = 96,
ThisKeyword = 97,
ThrowKeyword = 98,
TrueKeyword = 99,
TryKeyword = 100,
TypeOfKeyword = 101,
VarKeyword = 102,
VoidKeyword = 103,
WhileKeyword = 104,
WithKeyword = 105,
ImplementsKeyword = 106,
InterfaceKeyword = 107,
LetKeyword = 108,
PackageKeyword = 109,
PrivateKeyword = 110,
ProtectedKeyword = 111,
PublicKeyword = 112,
StaticKeyword = 113,
YieldKeyword = 114,
AbstractKeyword = 115,
AsKeyword = 116,
AnyKeyword = 117,
AsyncKeyword = 118,
AwaitKeyword = 119,
BooleanKeyword = 120,
ConstructorKeyword = 121,
DeclareKeyword = 122,
GetKeyword = 123,
IsKeyword = 124,
ModuleKeyword = 125,
NamespaceKeyword = 126,
RequireKeyword = 127,
NumberKeyword = 128,
SetKeyword = 129,
StringKeyword = 130,
SymbolKeyword = 131,
TypeKeyword = 132,
FromKeyword = 133,
OfKeyword = 134,
QualifiedName = 135,
ComputedPropertyName = 136,
TypeParameter = 137,
Parameter = 138,
Decorator = 139,
PropertySignature = 140,
PropertyDeclaration = 141,
MethodSignature = 142,
MethodDeclaration = 143,
Constructor = 144,
GetAccessor = 145,
SetAccessor = 146,
CallSignature = 147,
ConstructSignature = 148,
IndexSignature = 149,
TypePredicate = 150,
TypeReference = 151,
FunctionType = 152,
ConstructorType = 153,
TypeQuery = 154,
TypeLiteral = 155,
ArrayType = 156,
TupleType = 157,
UnionType = 158,
IntersectionType = 159,
ParenthesizedType = 160,
ObjectBindingPattern = 161,
ArrayBindingPattern = 162,
BindingElement = 163,
ArrayLiteralExpression = 164,
ObjectLiteralExpression = 165,
PropertyAccessExpression = 166,
ElementAccessExpression = 167,
CallExpression = 168,
NewExpression = 169,
TaggedTemplateExpression = 170,
TypeAssertionExpression = 171,
ParenthesizedExpression = 172,
FunctionExpression = 173,
ArrowFunction = 174,
DeleteExpression = 175,
TypeOfExpression = 176,
VoidExpression = 177,
AwaitExpression = 178,
PrefixUnaryExpression = 179,
PostfixUnaryExpression = 180,
BinaryExpression = 181,
ConditionalExpression = 182,
TemplateExpression = 183,
YieldExpression = 184,
SpreadElementExpression = 185,
ClassExpression = 186,
OmittedExpression = 187,
ExpressionWithTypeArguments = 188,
AsExpression = 189,
TemplateSpan = 190,
SemicolonClassElement = 191,
Block = 192,
VariableStatement = 193,
EmptyStatement = 194,
ExpressionStatement = 195,
IfStatement = 196,
DoStatement = 197,
WhileStatement = 198,
ForStatement = 199,
ForInStatement = 200,
ForOfStatement = 201,
ContinueStatement = 202,
BreakStatement = 203,
ReturnStatement = 204,
WithStatement = 205,
SwitchStatement = 206,
LabeledStatement = 207,
ThrowStatement = 208,
TryStatement = 209,
DebuggerStatement = 210,
VariableDeclaration = 211,
VariableDeclarationList = 212,
FunctionDeclaration = 213,
ClassDeclaration = 214,
InterfaceDeclaration = 215,
TypeAliasDeclaration = 216,
EnumDeclaration = 217,
ModuleDeclaration = 218,
ModuleBlock = 219,
CaseBlock = 220,
ImportEqualsDeclaration = 221,
ImportDeclaration = 222,
ImportClause = 223,
NamespaceImport = 224,
NamedImports = 225,
ImportSpecifier = 226,
ExportAssignment = 227,
ExportDeclaration = 228,
NamedExports = 229,
ExportSpecifier = 230,
MissingDeclaration = 231,
ExternalModuleReference = 232,
JsxElement = 233,
JsxSelfClosingElement = 234,
JsxOpeningElement = 235,
JsxText = 236,
JsxClosingElement = 237,
JsxAttribute = 238,
JsxSpreadAttribute = 239,
JsxExpression = 240,
CaseClause = 241,
DefaultClause = 242,
HeritageClause = 243,
CatchClause = 244,
PropertyAssignment = 245,
ShorthandPropertyAssignment = 246,
EnumMember = 247,
SourceFile = 248,
JSDocTypeExpression = 249,
JSDocAllType = 250,
JSDocUnknownType = 251,
JSDocArrayType = 252,
JSDocUnionType = 253,
JSDocTupleType = 254,
JSDocNullableType = 255,
JSDocNonNullableType = 256,
JSDocRecordType = 257,
JSDocRecordMember = 258,
JSDocTypeReference = 259,
JSDocOptionalType = 260,
JSDocFunctionType = 261,
JSDocVariadicType = 262,
JSDocConstructorType = 263,
JSDocThisType = 264,
JSDocComment = 265,
JSDocTag = 266,
JSDocParameterTag = 267,
JSDocReturnTag = 268,
JSDocTypeTag = 269,
JSDocTemplateTag = 270,
SyntaxList = 271,
Count = 272,
FirstAssignment = 56,
LastAssignment = 68,
FirstReservedWord = 70,
LastReservedWord = 105,
FirstKeyword = 70,
LastKeyword = 134,
FirstFutureReservedWord = 106,
LastFutureReservedWord = 114,
FirstTypeNode = 151,
LastTypeNode = 160,
FirstPunctuation = 15,
LastPunctuation = 66,
LastPunctuation = 68,
FirstToken = 0,
LastToken = 132,
LastToken = 134,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
@@ -322,8 +324,8 @@ declare namespace ts {
FirstTemplateToken = 11,
LastTemplateToken = 14,
FirstBinaryOperator = 25,
LastBinaryOperator = 66,
FirstNode = 133,
LastBinaryOperator = 68,
FirstNode = 135,
}
const enum NodeFlags {
Export = 1,
@@ -343,6 +345,7 @@ declare namespace ts {
OctalLiteral = 65536,
Namespace = 131072,
ExportContext = 262144,
ContainsThis = 524288,
Modifier = 2035,
AccessibilityModifier = 112,
BlockScoped = 49152,
@@ -438,6 +441,8 @@ declare namespace ts {
interface ShorthandPropertyAssignment extends ObjectLiteralElement {
name: Identifier;
questionToken?: Node;
equalsToken?: Node;
objectAssignmentInitializer?: Expression;
}
interface VariableLikeDeclaration extends Declaration {
propertyName?: Identifier;
@@ -530,18 +535,21 @@ declare namespace ts {
interface UnaryExpression extends Expression {
_unaryExpressionBrand: any;
}
interface PrefixUnaryExpression extends UnaryExpression {
interface IncrementExpression extends UnaryExpression {
_incrementExpressionBrand: any;
}
interface PrefixUnaryExpression extends IncrementExpression {
operator: SyntaxKind;
operand: UnaryExpression;
}
interface PostfixUnaryExpression extends PostfixExpression {
interface PostfixUnaryExpression extends IncrementExpression {
operand: LeftHandSideExpression;
operator: SyntaxKind;
}
interface PostfixExpression extends UnaryExpression {
_postfixExpressionBrand: any;
}
interface LeftHandSideExpression extends PostfixExpression {
interface LeftHandSideExpression extends IncrementExpression {
_leftHandSideExpressionBrand: any;
}
interface MemberExpression extends LeftHandSideExpression {
@@ -1082,6 +1090,7 @@ declare namespace ts {
decreaseIndent(): void;
clear(): void;
trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void;
reportInaccessibleThisError(): void;
}
const enum TypeFormatFlags {
None = 0,
@@ -1202,6 +1211,7 @@ declare namespace ts {
Instantiated = 131072,
ObjectLiteral = 524288,
ESSymbol = 16777216,
ThisType = 33554432,
StringLike = 258,
NumberLike = 132,
ObjectType = 80896,
@@ -1223,6 +1233,7 @@ declare namespace ts {
typeParameters: TypeParameter[];
outerTypeParameters: TypeParameter[];
localTypeParameters: TypeParameter[];
thisType: TypeParameter;
}
interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
declaredProperties: Symbol[];
@@ -1337,7 +1348,6 @@ declare namespace ts {
watch?: boolean;
isolatedModules?: boolean;
experimentalDecorators?: boolean;
experimentalAsyncFunctions?: boolean;
emitDecoratorMetadata?: boolean;
moduleResolution?: ModuleResolutionKind;
[option: string]: string | number | boolean;
@@ -1348,6 +1358,8 @@ declare namespace ts {
AMD = 2,
UMD = 3,
System = 4,
ES6 = 5,
ES2015 = 5,
}
const enum JsxEmit {
None = 0,
@@ -1366,6 +1378,7 @@ declare namespace ts {
ES3 = 0,
ES5 = 1,
ES6 = 2,
ES2015 = 2,
Latest = 2,
}
const enum LanguageVariant {
@@ -1417,7 +1430,8 @@ declare namespace ts {
write(s: string): void;
readFile(path: string, encoding?: string): string;
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
watchFile?(path: string, callback: (path: string) => void): FileWatcher;
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
resolvePath(path: string): string;
fileExists(path: string): boolean;
directoryExists(path: string): boolean;
@@ -1507,6 +1521,7 @@ declare namespace ts {
*/
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
function getTypeParameterOwner(d: Declaration): Declaration;
function arrayStructurallyIsEqualTo<T>(array1: Array<T>, array2: Array<T>): boolean;
}
declare namespace ts {
function getNodeConstructor(kind: SyntaxKind): new () => Node;
@@ -1542,7 +1557,7 @@ declare namespace ts {
* @param fileName The path to the config file
* @param jsonText The text of the config file
*/
function parseConfigFileText(fileName: string, jsonText: string): {
function parseConfigFileTextToJson(fileName: string, jsonText: string): {
config?: any;
error?: Diagnostic;
};
@@ -1552,7 +1567,7 @@ declare namespace ts {
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
}
declare namespace ts {
/** The version of the language service API */
@@ -1775,6 +1790,12 @@ declare namespace ts {
TabSize: number;
NewLineCharacter: string;
ConvertTabsToSpaces: boolean;
IndentStyle: IndentStyle;
}
enum IndentStyle {
None = 0,
Block = 1,
Smart = 2,
}
interface FormatCodeOptions extends EditorOptions {
InsertSpaceAfterCommaDelimiter: boolean;
+11679 -10829
View File
File diff suppressed because it is too large Load Diff
+275 -254
View File
@@ -68,253 +68,255 @@ declare namespace ts {
PlusToken = 35,
MinusToken = 36,
AsteriskToken = 37,
SlashToken = 38,
PercentToken = 39,
PlusPlusToken = 40,
MinusMinusToken = 41,
LessThanLessThanToken = 42,
GreaterThanGreaterThanToken = 43,
GreaterThanGreaterThanGreaterThanToken = 44,
AmpersandToken = 45,
BarToken = 46,
CaretToken = 47,
ExclamationToken = 48,
TildeToken = 49,
AmpersandAmpersandToken = 50,
BarBarToken = 51,
QuestionToken = 52,
ColonToken = 53,
AtToken = 54,
EqualsToken = 55,
PlusEqualsToken = 56,
MinusEqualsToken = 57,
AsteriskEqualsToken = 58,
SlashEqualsToken = 59,
PercentEqualsToken = 60,
LessThanLessThanEqualsToken = 61,
GreaterThanGreaterThanEqualsToken = 62,
GreaterThanGreaterThanGreaterThanEqualsToken = 63,
AmpersandEqualsToken = 64,
BarEqualsToken = 65,
CaretEqualsToken = 66,
Identifier = 67,
BreakKeyword = 68,
CaseKeyword = 69,
CatchKeyword = 70,
ClassKeyword = 71,
ConstKeyword = 72,
ContinueKeyword = 73,
DebuggerKeyword = 74,
DefaultKeyword = 75,
DeleteKeyword = 76,
DoKeyword = 77,
ElseKeyword = 78,
EnumKeyword = 79,
ExportKeyword = 80,
ExtendsKeyword = 81,
FalseKeyword = 82,
FinallyKeyword = 83,
ForKeyword = 84,
FunctionKeyword = 85,
IfKeyword = 86,
ImportKeyword = 87,
InKeyword = 88,
InstanceOfKeyword = 89,
NewKeyword = 90,
NullKeyword = 91,
ReturnKeyword = 92,
SuperKeyword = 93,
SwitchKeyword = 94,
ThisKeyword = 95,
ThrowKeyword = 96,
TrueKeyword = 97,
TryKeyword = 98,
TypeOfKeyword = 99,
VarKeyword = 100,
VoidKeyword = 101,
WhileKeyword = 102,
WithKeyword = 103,
ImplementsKeyword = 104,
InterfaceKeyword = 105,
LetKeyword = 106,
PackageKeyword = 107,
PrivateKeyword = 108,
ProtectedKeyword = 109,
PublicKeyword = 110,
StaticKeyword = 111,
YieldKeyword = 112,
AbstractKeyword = 113,
AsKeyword = 114,
AnyKeyword = 115,
AsyncKeyword = 116,
AwaitKeyword = 117,
BooleanKeyword = 118,
ConstructorKeyword = 119,
DeclareKeyword = 120,
GetKeyword = 121,
IsKeyword = 122,
ModuleKeyword = 123,
NamespaceKeyword = 124,
RequireKeyword = 125,
NumberKeyword = 126,
SetKeyword = 127,
StringKeyword = 128,
SymbolKeyword = 129,
TypeKeyword = 130,
FromKeyword = 131,
OfKeyword = 132,
QualifiedName = 133,
ComputedPropertyName = 134,
TypeParameter = 135,
Parameter = 136,
Decorator = 137,
PropertySignature = 138,
PropertyDeclaration = 139,
MethodSignature = 140,
MethodDeclaration = 141,
Constructor = 142,
GetAccessor = 143,
SetAccessor = 144,
CallSignature = 145,
ConstructSignature = 146,
IndexSignature = 147,
TypePredicate = 148,
TypeReference = 149,
FunctionType = 150,
ConstructorType = 151,
TypeQuery = 152,
TypeLiteral = 153,
ArrayType = 154,
TupleType = 155,
UnionType = 156,
IntersectionType = 157,
ParenthesizedType = 158,
ObjectBindingPattern = 159,
ArrayBindingPattern = 160,
BindingElement = 161,
ArrayLiteralExpression = 162,
ObjectLiteralExpression = 163,
PropertyAccessExpression = 164,
ElementAccessExpression = 165,
CallExpression = 166,
NewExpression = 167,
TaggedTemplateExpression = 168,
TypeAssertionExpression = 169,
ParenthesizedExpression = 170,
FunctionExpression = 171,
ArrowFunction = 172,
DeleteExpression = 173,
TypeOfExpression = 174,
VoidExpression = 175,
AwaitExpression = 176,
PrefixUnaryExpression = 177,
PostfixUnaryExpression = 178,
BinaryExpression = 179,
ConditionalExpression = 180,
TemplateExpression = 181,
YieldExpression = 182,
SpreadElementExpression = 183,
ClassExpression = 184,
OmittedExpression = 185,
ExpressionWithTypeArguments = 186,
AsExpression = 187,
TemplateSpan = 188,
SemicolonClassElement = 189,
Block = 190,
VariableStatement = 191,
EmptyStatement = 192,
ExpressionStatement = 193,
IfStatement = 194,
DoStatement = 195,
WhileStatement = 196,
ForStatement = 197,
ForInStatement = 198,
ForOfStatement = 199,
ContinueStatement = 200,
BreakStatement = 201,
ReturnStatement = 202,
WithStatement = 203,
SwitchStatement = 204,
LabeledStatement = 205,
ThrowStatement = 206,
TryStatement = 207,
DebuggerStatement = 208,
VariableDeclaration = 209,
VariableDeclarationList = 210,
FunctionDeclaration = 211,
ClassDeclaration = 212,
InterfaceDeclaration = 213,
TypeAliasDeclaration = 214,
EnumDeclaration = 215,
ModuleDeclaration = 216,
ModuleBlock = 217,
CaseBlock = 218,
ImportEqualsDeclaration = 219,
ImportDeclaration = 220,
ImportClause = 221,
NamespaceImport = 222,
NamedImports = 223,
ImportSpecifier = 224,
ExportAssignment = 225,
ExportDeclaration = 226,
NamedExports = 227,
ExportSpecifier = 228,
MissingDeclaration = 229,
ExternalModuleReference = 230,
JsxElement = 231,
JsxSelfClosingElement = 232,
JsxOpeningElement = 233,
JsxText = 234,
JsxClosingElement = 235,
JsxAttribute = 236,
JsxSpreadAttribute = 237,
JsxExpression = 238,
CaseClause = 239,
DefaultClause = 240,
HeritageClause = 241,
CatchClause = 242,
PropertyAssignment = 243,
ShorthandPropertyAssignment = 244,
EnumMember = 245,
SourceFile = 246,
JSDocTypeExpression = 247,
JSDocAllType = 248,
JSDocUnknownType = 249,
JSDocArrayType = 250,
JSDocUnionType = 251,
JSDocTupleType = 252,
JSDocNullableType = 253,
JSDocNonNullableType = 254,
JSDocRecordType = 255,
JSDocRecordMember = 256,
JSDocTypeReference = 257,
JSDocOptionalType = 258,
JSDocFunctionType = 259,
JSDocVariadicType = 260,
JSDocConstructorType = 261,
JSDocThisType = 262,
JSDocComment = 263,
JSDocTag = 264,
JSDocParameterTag = 265,
JSDocReturnTag = 266,
JSDocTypeTag = 267,
JSDocTemplateTag = 268,
SyntaxList = 269,
Count = 270,
FirstAssignment = 55,
LastAssignment = 66,
FirstReservedWord = 68,
LastReservedWord = 103,
FirstKeyword = 68,
LastKeyword = 132,
FirstFutureReservedWord = 104,
LastFutureReservedWord = 112,
FirstTypeNode = 149,
LastTypeNode = 158,
AsteriskAsteriskToken = 38,
SlashToken = 39,
PercentToken = 40,
PlusPlusToken = 41,
MinusMinusToken = 42,
LessThanLessThanToken = 43,
GreaterThanGreaterThanToken = 44,
GreaterThanGreaterThanGreaterThanToken = 45,
AmpersandToken = 46,
BarToken = 47,
CaretToken = 48,
ExclamationToken = 49,
TildeToken = 50,
AmpersandAmpersandToken = 51,
BarBarToken = 52,
QuestionToken = 53,
ColonToken = 54,
AtToken = 55,
EqualsToken = 56,
PlusEqualsToken = 57,
MinusEqualsToken = 58,
AsteriskEqualsToken = 59,
AsteriskAsteriskEqualsToken = 60,
SlashEqualsToken = 61,
PercentEqualsToken = 62,
LessThanLessThanEqualsToken = 63,
GreaterThanGreaterThanEqualsToken = 64,
GreaterThanGreaterThanGreaterThanEqualsToken = 65,
AmpersandEqualsToken = 66,
BarEqualsToken = 67,
CaretEqualsToken = 68,
Identifier = 69,
BreakKeyword = 70,
CaseKeyword = 71,
CatchKeyword = 72,
ClassKeyword = 73,
ConstKeyword = 74,
ContinueKeyword = 75,
DebuggerKeyword = 76,
DefaultKeyword = 77,
DeleteKeyword = 78,
DoKeyword = 79,
ElseKeyword = 80,
EnumKeyword = 81,
ExportKeyword = 82,
ExtendsKeyword = 83,
FalseKeyword = 84,
FinallyKeyword = 85,
ForKeyword = 86,
FunctionKeyword = 87,
IfKeyword = 88,
ImportKeyword = 89,
InKeyword = 90,
InstanceOfKeyword = 91,
NewKeyword = 92,
NullKeyword = 93,
ReturnKeyword = 94,
SuperKeyword = 95,
SwitchKeyword = 96,
ThisKeyword = 97,
ThrowKeyword = 98,
TrueKeyword = 99,
TryKeyword = 100,
TypeOfKeyword = 101,
VarKeyword = 102,
VoidKeyword = 103,
WhileKeyword = 104,
WithKeyword = 105,
ImplementsKeyword = 106,
InterfaceKeyword = 107,
LetKeyword = 108,
PackageKeyword = 109,
PrivateKeyword = 110,
ProtectedKeyword = 111,
PublicKeyword = 112,
StaticKeyword = 113,
YieldKeyword = 114,
AbstractKeyword = 115,
AsKeyword = 116,
AnyKeyword = 117,
AsyncKeyword = 118,
AwaitKeyword = 119,
BooleanKeyword = 120,
ConstructorKeyword = 121,
DeclareKeyword = 122,
GetKeyword = 123,
IsKeyword = 124,
ModuleKeyword = 125,
NamespaceKeyword = 126,
RequireKeyword = 127,
NumberKeyword = 128,
SetKeyword = 129,
StringKeyword = 130,
SymbolKeyword = 131,
TypeKeyword = 132,
FromKeyword = 133,
OfKeyword = 134,
QualifiedName = 135,
ComputedPropertyName = 136,
TypeParameter = 137,
Parameter = 138,
Decorator = 139,
PropertySignature = 140,
PropertyDeclaration = 141,
MethodSignature = 142,
MethodDeclaration = 143,
Constructor = 144,
GetAccessor = 145,
SetAccessor = 146,
CallSignature = 147,
ConstructSignature = 148,
IndexSignature = 149,
TypePredicate = 150,
TypeReference = 151,
FunctionType = 152,
ConstructorType = 153,
TypeQuery = 154,
TypeLiteral = 155,
ArrayType = 156,
TupleType = 157,
UnionType = 158,
IntersectionType = 159,
ParenthesizedType = 160,
ObjectBindingPattern = 161,
ArrayBindingPattern = 162,
BindingElement = 163,
ArrayLiteralExpression = 164,
ObjectLiteralExpression = 165,
PropertyAccessExpression = 166,
ElementAccessExpression = 167,
CallExpression = 168,
NewExpression = 169,
TaggedTemplateExpression = 170,
TypeAssertionExpression = 171,
ParenthesizedExpression = 172,
FunctionExpression = 173,
ArrowFunction = 174,
DeleteExpression = 175,
TypeOfExpression = 176,
VoidExpression = 177,
AwaitExpression = 178,
PrefixUnaryExpression = 179,
PostfixUnaryExpression = 180,
BinaryExpression = 181,
ConditionalExpression = 182,
TemplateExpression = 183,
YieldExpression = 184,
SpreadElementExpression = 185,
ClassExpression = 186,
OmittedExpression = 187,
ExpressionWithTypeArguments = 188,
AsExpression = 189,
TemplateSpan = 190,
SemicolonClassElement = 191,
Block = 192,
VariableStatement = 193,
EmptyStatement = 194,
ExpressionStatement = 195,
IfStatement = 196,
DoStatement = 197,
WhileStatement = 198,
ForStatement = 199,
ForInStatement = 200,
ForOfStatement = 201,
ContinueStatement = 202,
BreakStatement = 203,
ReturnStatement = 204,
WithStatement = 205,
SwitchStatement = 206,
LabeledStatement = 207,
ThrowStatement = 208,
TryStatement = 209,
DebuggerStatement = 210,
VariableDeclaration = 211,
VariableDeclarationList = 212,
FunctionDeclaration = 213,
ClassDeclaration = 214,
InterfaceDeclaration = 215,
TypeAliasDeclaration = 216,
EnumDeclaration = 217,
ModuleDeclaration = 218,
ModuleBlock = 219,
CaseBlock = 220,
ImportEqualsDeclaration = 221,
ImportDeclaration = 222,
ImportClause = 223,
NamespaceImport = 224,
NamedImports = 225,
ImportSpecifier = 226,
ExportAssignment = 227,
ExportDeclaration = 228,
NamedExports = 229,
ExportSpecifier = 230,
MissingDeclaration = 231,
ExternalModuleReference = 232,
JsxElement = 233,
JsxSelfClosingElement = 234,
JsxOpeningElement = 235,
JsxText = 236,
JsxClosingElement = 237,
JsxAttribute = 238,
JsxSpreadAttribute = 239,
JsxExpression = 240,
CaseClause = 241,
DefaultClause = 242,
HeritageClause = 243,
CatchClause = 244,
PropertyAssignment = 245,
ShorthandPropertyAssignment = 246,
EnumMember = 247,
SourceFile = 248,
JSDocTypeExpression = 249,
JSDocAllType = 250,
JSDocUnknownType = 251,
JSDocArrayType = 252,
JSDocUnionType = 253,
JSDocTupleType = 254,
JSDocNullableType = 255,
JSDocNonNullableType = 256,
JSDocRecordType = 257,
JSDocRecordMember = 258,
JSDocTypeReference = 259,
JSDocOptionalType = 260,
JSDocFunctionType = 261,
JSDocVariadicType = 262,
JSDocConstructorType = 263,
JSDocThisType = 264,
JSDocComment = 265,
JSDocTag = 266,
JSDocParameterTag = 267,
JSDocReturnTag = 268,
JSDocTypeTag = 269,
JSDocTemplateTag = 270,
SyntaxList = 271,
Count = 272,
FirstAssignment = 56,
LastAssignment = 68,
FirstReservedWord = 70,
LastReservedWord = 105,
FirstKeyword = 70,
LastKeyword = 134,
FirstFutureReservedWord = 106,
LastFutureReservedWord = 114,
FirstTypeNode = 151,
LastTypeNode = 160,
FirstPunctuation = 15,
LastPunctuation = 66,
LastPunctuation = 68,
FirstToken = 0,
LastToken = 132,
LastToken = 134,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
@@ -322,8 +324,8 @@ declare namespace ts {
FirstTemplateToken = 11,
LastTemplateToken = 14,
FirstBinaryOperator = 25,
LastBinaryOperator = 66,
FirstNode = 133,
LastBinaryOperator = 68,
FirstNode = 135,
}
const enum NodeFlags {
Export = 1,
@@ -343,6 +345,7 @@ declare namespace ts {
OctalLiteral = 65536,
Namespace = 131072,
ExportContext = 262144,
ContainsThis = 524288,
Modifier = 2035,
AccessibilityModifier = 112,
BlockScoped = 49152,
@@ -438,6 +441,8 @@ declare namespace ts {
interface ShorthandPropertyAssignment extends ObjectLiteralElement {
name: Identifier;
questionToken?: Node;
equalsToken?: Node;
objectAssignmentInitializer?: Expression;
}
interface VariableLikeDeclaration extends Declaration {
propertyName?: Identifier;
@@ -530,18 +535,21 @@ declare namespace ts {
interface UnaryExpression extends Expression {
_unaryExpressionBrand: any;
}
interface PrefixUnaryExpression extends UnaryExpression {
interface IncrementExpression extends UnaryExpression {
_incrementExpressionBrand: any;
}
interface PrefixUnaryExpression extends IncrementExpression {
operator: SyntaxKind;
operand: UnaryExpression;
}
interface PostfixUnaryExpression extends PostfixExpression {
interface PostfixUnaryExpression extends IncrementExpression {
operand: LeftHandSideExpression;
operator: SyntaxKind;
}
interface PostfixExpression extends UnaryExpression {
_postfixExpressionBrand: any;
}
interface LeftHandSideExpression extends PostfixExpression {
interface LeftHandSideExpression extends IncrementExpression {
_leftHandSideExpressionBrand: any;
}
interface MemberExpression extends LeftHandSideExpression {
@@ -1082,6 +1090,7 @@ declare namespace ts {
decreaseIndent(): void;
clear(): void;
trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void;
reportInaccessibleThisError(): void;
}
const enum TypeFormatFlags {
None = 0,
@@ -1202,6 +1211,7 @@ declare namespace ts {
Instantiated = 131072,
ObjectLiteral = 524288,
ESSymbol = 16777216,
ThisType = 33554432,
StringLike = 258,
NumberLike = 132,
ObjectType = 80896,
@@ -1223,6 +1233,7 @@ declare namespace ts {
typeParameters: TypeParameter[];
outerTypeParameters: TypeParameter[];
localTypeParameters: TypeParameter[];
thisType: TypeParameter;
}
interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
declaredProperties: Symbol[];
@@ -1337,7 +1348,6 @@ declare namespace ts {
watch?: boolean;
isolatedModules?: boolean;
experimentalDecorators?: boolean;
experimentalAsyncFunctions?: boolean;
emitDecoratorMetadata?: boolean;
moduleResolution?: ModuleResolutionKind;
[option: string]: string | number | boolean;
@@ -1348,6 +1358,8 @@ declare namespace ts {
AMD = 2,
UMD = 3,
System = 4,
ES6 = 5,
ES2015 = 5,
}
const enum JsxEmit {
None = 0,
@@ -1366,6 +1378,7 @@ declare namespace ts {
ES3 = 0,
ES5 = 1,
ES6 = 2,
ES2015 = 2,
Latest = 2,
}
const enum LanguageVariant {
@@ -1417,7 +1430,8 @@ declare namespace ts {
write(s: string): void;
readFile(path: string, encoding?: string): string;
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
watchFile?(path: string, callback: (path: string) => void): FileWatcher;
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
resolvePath(path: string): string;
fileExists(path: string): boolean;
directoryExists(path: string): boolean;
@@ -1507,6 +1521,7 @@ declare namespace ts {
*/
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
function getTypeParameterOwner(d: Declaration): Declaration;
function arrayStructurallyIsEqualTo<T>(array1: Array<T>, array2: Array<T>): boolean;
}
declare namespace ts {
function getNodeConstructor(kind: SyntaxKind): new () => Node;
@@ -1542,7 +1557,7 @@ declare namespace ts {
* @param fileName The path to the config file
* @param jsonText The text of the config file
*/
function parseConfigFileText(fileName: string, jsonText: string): {
function parseConfigFileTextToJson(fileName: string, jsonText: string): {
config?: any;
error?: Diagnostic;
};
@@ -1552,7 +1567,7 @@ declare namespace ts {
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
}
declare namespace ts {
/** The version of the language service API */
@@ -1775,6 +1790,12 @@ declare namespace ts {
TabSize: number;
NewLineCharacter: string;
ConvertTabsToSpaces: boolean;
IndentStyle: IndentStyle;
}
enum IndentStyle {
None = 0,
Block = 1,
Smart = 2,
}
interface FormatCodeOptions extends EditorOptions {
InsertSpaceAfterCommaDelimiter: boolean;
+11679 -10829
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
"version": "1.7.0",
"version": "1.8.0",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
+130 -132
View File
@@ -3716,7 +3716,9 @@ namespace ts {
function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature {
let links = getNodeLinks(declaration);
if (!links.resolvedSignature) {
let classType = declaration.kind === SyntaxKind.Constructor ? getDeclaredTypeOfClassOrInterface((<ClassDeclaration>declaration.parent).symbol) : undefined;
let classType = declaration.kind === SyntaxKind.Constructor ?
getDeclaredTypeOfClassOrInterface(getMergedSymbol((<ClassDeclaration>declaration.parent).symbol))
: undefined;
let typeParameters = classType ? classType.localTypeParameters :
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined;
let parameters: Symbol[] = [];
@@ -4897,7 +4899,7 @@ namespace ts {
if (apparentType.flags & (TypeFlags.ObjectType | TypeFlags.Intersection) && target.flags & TypeFlags.ObjectType) {
// Report structural errors only if we haven't reported any errors yet
let reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo;
if (result = objectTypeRelatedTo(apparentType, <ObjectType>target, reportStructuralErrors)) {
if (result = objectTypeRelatedTo(apparentType, source, target, reportStructuralErrors)) {
errorInfo = saveErrorInfo;
return result;
}
@@ -4919,7 +4921,7 @@ namespace ts {
return result;
}
}
return objectTypeRelatedTo(<ObjectType>source, <ObjectType>target, /*reportErrors*/ false);
return objectTypeRelatedTo(source, source, target, /*reportErrors*/ false);
}
if (source.flags & TypeFlags.TypeParameter && target.flags & TypeFlags.TypeParameter) {
return typeParameterIdenticalTo(<TypeParameter>source, <TypeParameter>target);
@@ -5073,11 +5075,11 @@ namespace ts {
// Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are
// equal and infinitely expanding. Fourth, if we have reached a depth of 100 nested comparisons, assume we have runaway recursion
// and issue an error. Otherwise, actually compare the structure of the two types.
function objectTypeRelatedTo(source: Type, target: Type, reportErrors: boolean): Ternary {
function objectTypeRelatedTo(apparentSource: Type, originalSource: Type, target: Type, reportErrors: boolean): Ternary {
if (overflow) {
return Ternary.False;
}
let id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id;
let id = relation !== identityRelation || apparentSource.id < target.id ? apparentSource.id + "," + target.id : target.id + "," + apparentSource.id;
let related = relation[id];
if (related !== undefined) {
// If we computed this relation already and it was failed and reported, or if we're not being asked to elaborate
@@ -5104,28 +5106,28 @@ namespace ts {
maybeStack = [];
expandingFlags = 0;
}
sourceStack[depth] = source;
sourceStack[depth] = apparentSource;
targetStack[depth] = target;
maybeStack[depth] = {};
maybeStack[depth][id] = RelationComparisonResult.Succeeded;
depth++;
let saveExpandingFlags = expandingFlags;
if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack, depth)) expandingFlags |= 1;
if (!(expandingFlags & 1) && isDeeplyNestedGeneric(apparentSource, sourceStack, depth)) expandingFlags |= 1;
if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack, depth)) expandingFlags |= 2;
let result: Ternary;
if (expandingFlags === 3) {
result = Ternary.Maybe;
}
else {
result = propertiesRelatedTo(source, target, reportErrors);
result = propertiesRelatedTo(apparentSource, target, reportErrors);
if (result) {
result &= signaturesRelatedTo(source, target, SignatureKind.Call, reportErrors);
result &= signaturesRelatedTo(apparentSource, target, SignatureKind.Call, reportErrors);
if (result) {
result &= signaturesRelatedTo(source, target, SignatureKind.Construct, reportErrors);
result &= signaturesRelatedTo(apparentSource, target, SignatureKind.Construct, reportErrors);
if (result) {
result &= stringIndexTypesRelatedTo(source, target, reportErrors);
result &= stringIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors);
if (result) {
result &= numberIndexTypesRelatedTo(source, target, reportErrors);
result &= numberIndexTypesRelatedTo(apparentSource, originalSource, target, reportErrors);
}
}
}
@@ -5456,12 +5458,17 @@ namespace ts {
return result;
}
function stringIndexTypesRelatedTo(source: Type, target: Type, reportErrors: boolean): Ternary {
function stringIndexTypesRelatedTo(source: Type, originalSource: Type, target: Type, reportErrors: boolean): Ternary {
if (relation === identityRelation) {
return indexTypesIdenticalTo(IndexKind.String, source, target);
}
let targetType = getIndexTypeOfType(target, IndexKind.String);
if (targetType && !(targetType.flags & TypeFlags.Any)) {
if (targetType) {
if ((targetType.flags & TypeFlags.Any) && !(originalSource.flags & TypeFlags.Primitive)) {
// non-primitive assignment to any is always allowed, eg
// `var x: { [index: string]: any } = { property: 12 };`
return Ternary.True;
}
let sourceType = getIndexTypeOfType(source, IndexKind.String);
if (!sourceType) {
if (reportErrors) {
@@ -5481,12 +5488,17 @@ namespace ts {
return Ternary.True;
}
function numberIndexTypesRelatedTo(source: Type, target: Type, reportErrors: boolean): Ternary {
function numberIndexTypesRelatedTo(source: Type, originalSource: Type, target: Type, reportErrors: boolean): Ternary {
if (relation === identityRelation) {
return indexTypesIdenticalTo(IndexKind.Number, source, target);
}
let targetType = getIndexTypeOfType(target, IndexKind.Number);
if (targetType && !(targetType.flags & TypeFlags.Any)) {
if (targetType) {
if ((targetType.flags & TypeFlags.Any) && !(originalSource.flags & TypeFlags.Primitive)) {
// non-primitive assignment to any is always allowed, eg
// `var x: { [index: number]: any } = { property: 12 };`
return Ternary.True;
}
let sourceStringType = getIndexTypeOfType(source, IndexKind.String);
let sourceNumberType = getIndexTypeOfType(source, IndexKind.Number);
if (!(sourceStringType || sourceNumberType)) {
@@ -8647,39 +8659,36 @@ namespace ts {
*/
function getEffectiveDecoratorFirstArgumentType(node: Node): Type {
// The first argument to a decorator is its `target`.
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ClassExpression:
// For a class decorator, the `target` is the type of the class (e.g. the
// "static" or "constructor" side of the class)
if (node.kind === SyntaxKind.ClassDeclaration) {
// For a class decorator, the `target` is the type of the class (e.g. the
// "static" or "constructor" side of the class)
let classSymbol = getSymbolOfNode(node);
return getTypeOfSymbol(classSymbol);
}
if (node.kind === SyntaxKind.Parameter) {
// For a parameter decorator, the `target` is the parent type of the
// parameter's containing method.
node = node.parent;
if (node.kind === SyntaxKind.Constructor) {
let classSymbol = getSymbolOfNode(node);
return getTypeOfSymbol(classSymbol);
case SyntaxKind.Parameter:
// For a parameter decorator, the `target` is the parent type of the
// parameter's containing method.
node = node.parent;
if (node.kind === SyntaxKind.Constructor) {
let classSymbol = getSymbolOfNode(node);
return getTypeOfSymbol(classSymbol);
}
// fall-through
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
// For a property or method decorator, the `target` is the
// "static"-side type of the parent of the member if the member is
// declared "static"; otherwise, it is the "instance"-side type of the
// parent of the member.
return getParentTypeOfClassElement(<ClassElement>node);
default:
Debug.fail("Unsupported decorator target.");
return unknownType;
}
}
if (node.kind === SyntaxKind.PropertyDeclaration ||
node.kind === SyntaxKind.MethodDeclaration ||
node.kind === SyntaxKind.GetAccessor ||
node.kind === SyntaxKind.SetAccessor) {
// For a property or method decorator, the `target` is the
// "static"-side type of the parent of the member if the member is
// declared "static"; otherwise, it is the "instance"-side type of the
// parent of the member.
return getParentTypeOfClassElement(<ClassElement>node);
}
Debug.fail("Unsupported decorator target.");
return unknownType;
}
/**
@@ -8699,57 +8708,54 @@ namespace ts {
*/
function getEffectiveDecoratorSecondArgumentType(node: Node) {
// The second argument to a decorator is its `propertyKey`
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
Debug.fail("Class decorators should not have a second synthetic argument.");
return unknownType;
if (node.kind === SyntaxKind.ClassDeclaration) {
Debug.fail("Class decorators should not have a second synthetic argument.");
return unknownType;
}
case SyntaxKind.Parameter:
node = node.parent;
if (node.kind === SyntaxKind.Constructor) {
// For a constructor parameter decorator, the `propertyKey` will be `undefined`.
return anyType;
}
if (node.kind === SyntaxKind.Parameter) {
node = node.parent;
if (node.kind === SyntaxKind.Constructor) {
// For a constructor parameter decorator, the `propertyKey` will be `undefined`.
return anyType;
}
// For a non-constructor parameter decorator, the `propertyKey` will be either
// a string or a symbol, based on the name of the parameter's containing method.
// fall-through
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
// The `propertyKey` for a property or method decorator will be a
// string literal type if the member name is an identifier, number, or string;
// otherwise, if the member name is a computed property name it will
// be either string or symbol.
let element = <ClassElement>node;
switch (element.name.kind) {
case SyntaxKind.Identifier:
case SyntaxKind.NumericLiteral:
case SyntaxKind.StringLiteral:
return getStringLiteralType(<StringLiteral>element.name);
case SyntaxKind.ComputedPropertyName:
let nameType = checkComputedPropertyName(<ComputedPropertyName>element.name);
if (allConstituentTypesHaveKind(nameType, TypeFlags.ESSymbol)) {
return nameType;
}
else {
return stringType;
}
default:
Debug.fail("Unsupported property name.");
return unknownType;
}
default:
Debug.fail("Unsupported decorator target.");
return unknownType;
}
if (node.kind === SyntaxKind.PropertyDeclaration ||
node.kind === SyntaxKind.MethodDeclaration ||
node.kind === SyntaxKind.GetAccessor ||
node.kind === SyntaxKind.SetAccessor) {
// The `propertyKey` for a property or method decorator will be a
// string literal type if the member name is an identifier, number, or string;
// otherwise, if the member name is a computed property name it will
// be either string or symbol.
let element = <ClassElement>node;
switch (element.name.kind) {
case SyntaxKind.Identifier:
case SyntaxKind.NumericLiteral:
case SyntaxKind.StringLiteral:
return getStringLiteralType(<StringLiteral>element.name);
case SyntaxKind.ComputedPropertyName:
let nameType = checkComputedPropertyName(<ComputedPropertyName>element.name);
if (allConstituentTypesHaveKind(nameType, TypeFlags.ESSymbol)) {
return nameType;
}
else {
return stringType;
}
default:
Debug.fail("Unsupported property name.");
return unknownType;
}
}
Debug.fail("Unsupported decorator target.");
return unknownType;
}
/**
@@ -8762,31 +8768,32 @@ namespace ts {
function getEffectiveDecoratorThirdArgumentType(node: Node) {
// The third argument to a decorator is either its `descriptor` for a method decorator
// or its `parameterIndex` for a paramter decorator
switch (node.kind) {
case SyntaxKind.ClassDeclaration:
Debug.fail("Class decorators should not have a third synthetic argument.");
return unknownType;
case SyntaxKind.Parameter:
// The `parameterIndex` for a parameter decorator is always a number
return numberType;
case SyntaxKind.PropertyDeclaration:
Debug.fail("Property decorators should not have a third synthetic argument.");
return unknownType;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
// The `descriptor` for a method decorator will be a `TypedPropertyDescriptor<T>`
// for the type of the member.
let propertyType = getTypeOfNode(node);
return createTypedPropertyDescriptorType(propertyType);
default:
Debug.fail("Unsupported decorator target.");
return unknownType;
if (node.kind === SyntaxKind.ClassDeclaration) {
Debug.fail("Class decorators should not have a third synthetic argument.");
return unknownType;
}
if (node.kind === SyntaxKind.Parameter) {
// The `parameterIndex` for a parameter decorator is always a number
return numberType;
}
if (node.kind === SyntaxKind.PropertyDeclaration) {
Debug.fail("Property decorators should not have a third synthetic argument.");
return unknownType;
}
if (node.kind === SyntaxKind.MethodDeclaration ||
node.kind === SyntaxKind.GetAccessor ||
node.kind === SyntaxKind.SetAccessor) {
// The `descriptor` for a method decorator will be a `TypedPropertyDescriptor<T>`
// for the type of the member.
let propertyType = getTypeOfNode(node);
return createTypedPropertyDescriptorType(propertyType);
}
Debug.fail("Unsupported decorator target.");
return unknownType;
}
/**
@@ -11043,7 +11050,13 @@ namespace ts {
function getEffectiveDeclarationFlags(n: Node, flagsToCheck: NodeFlags): NodeFlags {
let flags = getCombinedNodeFlags(n);
if (n.parent.kind !== SyntaxKind.InterfaceDeclaration && isInAmbientContext(n)) {
// children of classes (even ambient classes) should not be marked as ambient or export
// because those flags have no useful semantics there.
if (n.parent.kind !== SyntaxKind.InterfaceDeclaration &&
n.parent.kind !== SyntaxKind.ClassDeclaration &&
n.parent.kind !== SyntaxKind.ClassExpression &&
isInAmbientContext(n)) {
if (!(flags & NodeFlags.Ambient)) {
// It is nested in an ambient context, which means it is automatically exported
flags |= NodeFlags.Export;
@@ -12866,11 +12879,6 @@ namespace ts {
}
checkClassLikeDeclaration(node);
// Interfaces cannot be merged with non-ambient classes.
if (getSymbolOfNode(node).flags & SymbolFlags.Interface && !isInAmbientContext(node)) {
error(node, Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface);
}
forEach(node.members, checkSourceElement);
}
@@ -13156,16 +13164,6 @@ namespace ts {
checkIndexConstraints(type);
}
}
// Interfaces cannot merge with non-ambient classes.
if (symbol && symbol.declarations) {
for (let declaration of symbol.declarations) {
if (declaration.kind === SyntaxKind.ClassDeclaration && !isInAmbientContext(declaration)) {
error(node, Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface);
break;
}
}
}
}
forEach(getInterfaceBaseTypeNodes(node), heritageElement => {
if (!isSupportedExpressionWithTypeArguments(heritageElement)) {
+50 -47
View File
@@ -430,63 +430,19 @@ namespace ts {
/**
* Parse the contents of a config file (tsconfig.json).
* @param json The contents of the config file to parse
* @param host Instance of ParseConfigHost used to enumerate files in folder.
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine {
let errors: Diagnostic[] = [];
let { options, errors } = convertCompilerOptionsFromJson(json["compilerOptions"], basePath);
return {
options: getCompilerOptions(),
options,
fileNames: getFileNames(),
errors
};
function getCompilerOptions(): CompilerOptions {
let options: CompilerOptions = {};
let optionNameMap: Map<CommandLineOption> = {};
forEach(optionDeclarations, option => {
optionNameMap[option.name] = option;
});
let jsonOptions = json["compilerOptions"];
if (jsonOptions) {
for (let id in jsonOptions) {
if (hasProperty(optionNameMap, id)) {
let opt = optionNameMap[id];
let optType = opt.type;
let value = jsonOptions[id];
let expectedType = typeof optType === "string" ? optType : "string";
if (typeof value === expectedType) {
if (typeof optType !== "string") {
let key = value.toLowerCase();
if (hasProperty(optType, key)) {
value = optType[key];
}
else {
errors.push(createCompilerDiagnostic((<CommandLineOptionOfCustomType>opt).error));
value = 0;
}
}
if (opt.isFilePath) {
value = normalizePath(combinePaths(basePath, value));
if (value === "") {
value = ".";
}
}
options[opt.name] = value;
}
else {
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType));
}
}
else {
errors.push(createCompilerDiagnostic(Diagnostics.Unknown_compiler_option_0, id));
}
}
}
return options;
}
function getFileNames(): string[] {
let fileNames: string[] = [];
if (hasProperty(json, "files")) {
@@ -521,4 +477,51 @@ namespace ts {
return fileNames;
}
}
export function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string): { options: CompilerOptions, errors: Diagnostic[] } {
let options: CompilerOptions = {};
let errors: Diagnostic[] = [];
if (!jsonOptions) {
return { options, errors };
}
let optionNameMap = arrayToMap(optionDeclarations, opt => opt.name);
for (let id in jsonOptions) {
if (hasProperty(optionNameMap, id)) {
let opt = optionNameMap[id];
let optType = opt.type;
let value = jsonOptions[id];
let expectedType = typeof optType === "string" ? optType : "string";
if (typeof value === expectedType) {
if (typeof optType !== "string") {
let key = value.toLowerCase();
if (hasProperty(optType, key)) {
value = optType[key];
}
else {
errors.push(createCompilerDiagnostic((<CommandLineOptionOfCustomType>opt).error));
value = 0;
}
}
if (opt.isFilePath) {
value = normalizePath(combinePaths(basePath, value));
if (value === "") {
value = ".";
}
}
options[opt.name] = value;
}
else {
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType));
}
}
else {
errors.push(createCompilerDiagnostic(Diagnostics.Unknown_compiler_option_0, id));
}
}
return { options, errors };
}
}
-4
View File
@@ -1620,10 +1620,6 @@
"category": "Error",
"code":2517
},
"Only an ambient class can be merged with an interface.": {
"category": "Error",
"code": 2518
},
"Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.": {
"category": "Error",
"code": 2520
+1 -1
View File
@@ -12,7 +12,7 @@ namespace ts {
let emptyArray: any[] = [];
export const version = "1.7.0";
export const version = "1.8.0";
export function findConfigFile(searchPath: string): string {
let fileName = "tsconfig.json";
+1 -1
View File
@@ -1309,7 +1309,7 @@ namespace ts {
getCurrentDirectory(): string;
}
export interface ParseConfigHost extends ModuleResolutionHost {
export interface ParseConfigHost {
readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
}
+1 -1
View File
@@ -1210,7 +1210,7 @@ interface ArrayBuffer {
interface ArrayBufferConstructor {
prototype: ArrayBuffer;
new (byteLength: number): ArrayBuffer;
isView(arg: any): boolean;
isView(arg: any): arg is ArrayBufferView;
}
declare var ArrayBuffer: ArrayBufferConstructor;
@@ -0,0 +1,12 @@
//// [ambientClassMergesOverloadsWithInterface.ts]
declare class C {
baz(): any;
foo(n: number): any;
}
interface C {
foo(n: number): any;
bar(): any;
}
//// [ambientClassMergesOverloadsWithInterface.js]
@@ -0,0 +1,22 @@
=== tests/cases/compiler/ambientClassMergesOverloadsWithInterface.ts ===
declare class C {
>C : Symbol(C, Decl(ambientClassMergesOverloadsWithInterface.ts, 0, 0), Decl(ambientClassMergesOverloadsWithInterface.ts, 3, 1))
baz(): any;
>baz : Symbol(baz, Decl(ambientClassMergesOverloadsWithInterface.ts, 0, 17))
foo(n: number): any;
>foo : Symbol(foo, Decl(ambientClassMergesOverloadsWithInterface.ts, 1, 15), Decl(ambientClassMergesOverloadsWithInterface.ts, 4, 13))
>n : Symbol(n, Decl(ambientClassMergesOverloadsWithInterface.ts, 2, 8))
}
interface C {
>C : Symbol(C, Decl(ambientClassMergesOverloadsWithInterface.ts, 0, 0), Decl(ambientClassMergesOverloadsWithInterface.ts, 3, 1))
foo(n: number): any;
>foo : Symbol(foo, Decl(ambientClassMergesOverloadsWithInterface.ts, 1, 15), Decl(ambientClassMergesOverloadsWithInterface.ts, 4, 13))
>n : Symbol(n, Decl(ambientClassMergesOverloadsWithInterface.ts, 5, 8))
bar(): any;
>bar : Symbol(bar, Decl(ambientClassMergesOverloadsWithInterface.ts, 5, 24))
}
@@ -0,0 +1,22 @@
=== tests/cases/compiler/ambientClassMergesOverloadsWithInterface.ts ===
declare class C {
>C : C
baz(): any;
>baz : () => any
foo(n: number): any;
>foo : { (n: number): any; (n: number): any; }
>n : number
}
interface C {
>C : C
foo(n: number): any;
>foo : { (n: number): any; (n: number): any; }
>n : number
bar(): any;
>bar : () => any
}
@@ -0,0 +1,13 @@
//// [arrayBufferIsViewNarrowsType.ts]
var obj: Object;
if (ArrayBuffer.isView(obj)) {
// isView should be a guard that narrows type to ArrayBufferView.
var ab: ArrayBufferView = obj;
}
//// [arrayBufferIsViewNarrowsType.js]
var obj;
if (ArrayBuffer.isView(obj)) {
// isView should be a guard that narrows type to ArrayBufferView.
var ab = obj;
}
@@ -0,0 +1,17 @@
=== tests/cases/compiler/arrayBufferIsViewNarrowsType.ts ===
var obj: Object;
>obj : Symbol(obj, Decl(arrayBufferIsViewNarrowsType.ts, 0, 3))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
if (ArrayBuffer.isView(obj)) {
>ArrayBuffer.isView : Symbol(ArrayBufferConstructor.isView, Decl(lib.d.ts, --, --))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>isView : Symbol(ArrayBufferConstructor.isView, Decl(lib.d.ts, --, --))
>obj : Symbol(obj, Decl(arrayBufferIsViewNarrowsType.ts, 0, 3))
// isView should be a guard that narrows type to ArrayBufferView.
var ab: ArrayBufferView = obj;
>ab : Symbol(ab, Decl(arrayBufferIsViewNarrowsType.ts, 3, 7))
>ArrayBufferView : Symbol(ArrayBufferView, Decl(lib.d.ts, --, --))
>obj : Symbol(obj, Decl(arrayBufferIsViewNarrowsType.ts, 0, 3))
}
@@ -0,0 +1,18 @@
=== tests/cases/compiler/arrayBufferIsViewNarrowsType.ts ===
var obj: Object;
>obj : Object
>Object : Object
if (ArrayBuffer.isView(obj)) {
>ArrayBuffer.isView(obj) : boolean
>ArrayBuffer.isView : (arg: any) => arg is ArrayBufferView
>ArrayBuffer : ArrayBufferConstructor
>isView : (arg: any) => arg is ArrayBufferView
>obj : Object
// isView should be a guard that narrows type to ArrayBufferView.
var ab: ArrayBufferView = obj;
>ab : ArrayBufferView
>ArrayBufferView : ArrayBufferView
>obj : ArrayBufferView
}
@@ -2,9 +2,13 @@ tests/cases/compiler/assignmentCompat1.ts(4,1): error TS2322: Type '{ [index: st
Property 'one' is missing in type '{ [index: string]: any; }'.
tests/cases/compiler/assignmentCompat1.ts(6,1): error TS2322: Type '{ [index: number]: any; }' is not assignable to type '{ one: number; }'.
Property 'one' is missing in type '{ [index: number]: any; }'.
tests/cases/compiler/assignmentCompat1.ts(8,1): error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'.
Index signature is missing in type 'String'.
tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'.
Index signature is missing in type 'Boolean'.
==== tests/cases/compiler/assignmentCompat1.ts (2 errors) ====
==== tests/cases/compiler/assignmentCompat1.ts (4 errors) ====
var x = { one: 1 };
var y: { [index: string]: any };
var z: { [index: number]: any };
@@ -18,4 +22,14 @@ tests/cases/compiler/assignmentCompat1.ts(6,1): error TS2322: Type '{ [index: nu
!!! error TS2322: Type '{ [index: number]: any; }' is not assignable to type '{ one: number; }'.
!!! error TS2322: Property 'one' is missing in type '{ [index: number]: any; }'.
z = x; // Ok because index signature type is any
y = "foo"; // Error
~
!!! error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'.
!!! error TS2322: Index signature is missing in type 'String'.
z = "foo"; // OK, string has numeric indexer
z = false; // Error
~
!!! error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'.
!!! error TS2322: Index signature is missing in type 'Boolean'.
@@ -6,6 +6,10 @@ x = y; // Error
y = x; // Ok because index signature type is any
x = z; // Error
z = x; // Ok because index signature type is any
y = "foo"; // Error
z = "foo"; // OK, string has numeric indexer
z = false; // Error
//// [assignmentCompat1.js]
@@ -16,3 +20,6 @@ x = y; // Error
y = x; // Ok because index signature type is any
x = z; // Error
z = x; // Ok because index signature type is any
y = "foo"; // Error
z = "foo"; // OK, string has numeric indexer
z = false; // Error
@@ -1,24 +1,18 @@
tests/cases/compiler/augmentedTypesClass2.ts(4,7): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/augmentedTypesClass2.ts(10,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/augmentedTypesClass2.ts(16,7): error TS2300: Duplicate identifier 'c33'.
tests/cases/compiler/augmentedTypesClass2.ts(21,6): error TS2300: Duplicate identifier 'c33'.
==== tests/cases/compiler/augmentedTypesClass2.ts (4 errors) ====
==== tests/cases/compiler/augmentedTypesClass2.ts (2 errors) ====
// Checking class with other things in type space not value space
// class then interface
class c11 { // error
~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
class c11 {
foo() {
return 1;
}
}
interface c11 { // error
~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface c11 {
bar(): void;
}
@@ -2,13 +2,13 @@
// Checking class with other things in type space not value space
// class then interface
class c11 { // error
class c11 {
foo() {
return 1;
}
}
interface c11 { // error
interface c11 {
bar(): void;
}
@@ -1,10 +1,8 @@
tests/cases/compiler/augmentedTypesInterface.ts(12,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/augmentedTypesInterface.ts(16,7): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/augmentedTypesInterface.ts(23,11): error TS2300: Duplicate identifier 'i3'.
tests/cases/compiler/augmentedTypesInterface.ts(26,6): error TS2300: Duplicate identifier 'i3'.
==== tests/cases/compiler/augmentedTypesInterface.ts (4 errors) ====
==== tests/cases/compiler/augmentedTypesInterface.ts (2 errors) ====
// interface then interface
interface i {
@@ -16,15 +14,11 @@ tests/cases/compiler/augmentedTypesInterface.ts(26,6): error TS2300: Duplicate i
}
// interface then class
interface i2 { // error
~~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface i2 {
foo(): void;
}
class i2 { // error
~~
!!! error TS2518: Only an ambient class can be merged with an interface.
class i2 {
bar() {
return 1;
}
@@ -10,11 +10,11 @@ interface i {
}
// interface then class
interface i2 { // error
interface i2 {
foo(): void;
}
class i2 { // error
class i2 {
bar() {
return 1;
}
@@ -1,7 +1,3 @@
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(7,16): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(8,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(10,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(11,16): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(13,16): error TS2300: Duplicate identifier 'CC1'.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(14,7): error TS2300: Duplicate identifier 'CC1'.
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(16,7): error TS2300: Duplicate identifier 'CC2'.
@@ -20,7 +16,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(39,1): error TS2511: Cannot create an instance of the abstract class 'DCC1'.
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts (20 errors) ====
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts (16 errors) ====
abstract class CM {}
module CM {}
@@ -28,18 +24,10 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst
abstract class MC {}
abstract class CI {}
~~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface CI {}
~~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface IC {}
~~
!!! error TS2518: Only an ambient class can be merged with an interface.
abstract class IC {}
~~
!!! error TS2518: Only an ambient class can be merged with an interface.
abstract class CC1 {}
~~~
@@ -1,37 +1,25 @@
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(1,7): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(1,11): error TS2300: Duplicate identifier 'foo'.
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(2,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(2,15): error TS2300: Duplicate identifier 'foo'.
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(5,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(6,9): error TS2300: Duplicate identifier 'bar'.
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(9,15): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(10,9): error TS2300: Duplicate identifier 'bar'.
==== tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts (8 errors) ====
==== tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts (4 errors) ====
class C { foo: string; }
~
!!! error TS2518: Only an ambient class can be merged with an interface.
~~~
!!! error TS2300: Duplicate identifier 'foo'.
interface C { foo: string; } // error
~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface C { foo: string; }
~~~
!!! error TS2300: Duplicate identifier 'foo'.
module M {
class D {
~
!!! error TS2518: Only an ambient class can be merged with an interface.
bar: string;
~~~
!!! error TS2300: Duplicate identifier 'bar'.
}
interface D { // error
~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface D {
bar: string;
~~~
!!! error TS2300: Duplicate identifier 'bar'.
@@ -1,13 +1,13 @@
//// [classAndInterfaceWithSameName.ts]
class C { foo: string; }
interface C { foo: string; } // error
interface C { foo: string; }
module M {
class D {
bar: string;
}
interface D { // error
interface D {
bar: string;
}
}
@@ -1,52 +0,0 @@
tests/cases/compiler/clinterfaces.ts(2,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/clinterfaces.ts(3,15): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/clinterfaces.ts(4,15): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/clinterfaces.ts(5,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/clinterfaces.ts(8,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/clinterfaces.ts(12,7): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/clinterfaces.ts(16,7): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/clinterfaces.ts(20,11): error TS2518: Only an ambient class can be merged with an interface.
==== tests/cases/compiler/clinterfaces.ts (8 errors) ====
module M {
class C { }
~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface C { }
~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface D { }
~
!!! error TS2518: Only an ambient class can be merged with an interface.
class D { }
~
!!! error TS2518: Only an ambient class can be merged with an interface.
}
interface Foo<T> {
~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
a: string;
}
class Foo<T>{
~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
b: number;
}
class Bar<T>{
~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
b: number;
}
interface Bar<T> {
~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
a: string;
}
export = Foo;
@@ -0,0 +1,52 @@
=== tests/cases/compiler/clinterfaces.ts ===
module M {
>M : Symbol(M, Decl(clinterfaces.ts, 0, 0))
class C { }
>C : Symbol(C, Decl(clinterfaces.ts, 0, 10), Decl(clinterfaces.ts, 1, 15))
interface C { }
>C : Symbol(C, Decl(clinterfaces.ts, 0, 10), Decl(clinterfaces.ts, 1, 15))
interface D { }
>D : Symbol(D, Decl(clinterfaces.ts, 2, 19), Decl(clinterfaces.ts, 3, 19))
class D { }
>D : Symbol(D, Decl(clinterfaces.ts, 2, 19), Decl(clinterfaces.ts, 3, 19))
}
interface Foo<T> {
>Foo : Symbol(Foo, Decl(clinterfaces.ts, 5, 1), Decl(clinterfaces.ts, 9, 1))
>T : Symbol(T, Decl(clinterfaces.ts, 7, 14), Decl(clinterfaces.ts, 11, 10))
a: string;
>a : Symbol(a, Decl(clinterfaces.ts, 7, 18))
}
class Foo<T>{
>Foo : Symbol(Foo, Decl(clinterfaces.ts, 5, 1), Decl(clinterfaces.ts, 9, 1))
>T : Symbol(T, Decl(clinterfaces.ts, 7, 14), Decl(clinterfaces.ts, 11, 10))
b: number;
>b : Symbol(b, Decl(clinterfaces.ts, 11, 13))
}
class Bar<T>{
>Bar : Symbol(Bar, Decl(clinterfaces.ts, 13, 1), Decl(clinterfaces.ts, 17, 1))
>T : Symbol(T, Decl(clinterfaces.ts, 15, 10), Decl(clinterfaces.ts, 19, 14))
b: number;
>b : Symbol(b, Decl(clinterfaces.ts, 15, 13))
}
interface Bar<T> {
>Bar : Symbol(Bar, Decl(clinterfaces.ts, 13, 1), Decl(clinterfaces.ts, 17, 1))
>T : Symbol(T, Decl(clinterfaces.ts, 15, 10), Decl(clinterfaces.ts, 19, 14))
a: string;
>a : Symbol(a, Decl(clinterfaces.ts, 19, 18))
}
export = Foo;
>Foo : Symbol(Foo, Decl(clinterfaces.ts, 5, 1), Decl(clinterfaces.ts, 9, 1))
@@ -0,0 +1,52 @@
=== tests/cases/compiler/clinterfaces.ts ===
module M {
>M : typeof M
class C { }
>C : C
interface C { }
>C : C
interface D { }
>D : D
class D { }
>D : D
}
interface Foo<T> {
>Foo : Foo<T>
>T : T
a: string;
>a : string
}
class Foo<T>{
>Foo : Foo<T>
>T : T
b: number;
>b : number
}
class Bar<T>{
>Bar : Bar<T>
>T : T
b: number;
>b : number
}
interface Bar<T> {
>Bar : Bar<T>
>T : T
a: string;
>a : string
}
export = Foo;
>Foo : Foo<T>
@@ -1,19 +0,0 @@
tests/cases/compiler/declInput.ts(1,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/declInput.ts(5,7): error TS2518: Only an ambient class can be merged with an interface.
==== tests/cases/compiler/declInput.ts (2 errors) ====
interface bar {
~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
}
class bar {
~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
public f() { return ''; }
public g() { return {a: <bar>null, b: undefined, c: void 4 }; }
public h(x = 4, y = null, z = '') { x++; }
}
@@ -0,0 +1,28 @@
=== tests/cases/compiler/declInput.ts ===
interface bar {
>bar : Symbol(bar, Decl(declInput.ts, 0, 0), Decl(declInput.ts, 2, 1))
}
class bar {
>bar : Symbol(bar, Decl(declInput.ts, 0, 0), Decl(declInput.ts, 2, 1))
public f() { return ''; }
>f : Symbol(f, Decl(declInput.ts, 4, 11))
public g() { return {a: <bar>null, b: undefined, c: void 4 }; }
>g : Symbol(g, Decl(declInput.ts, 5, 27))
>a : Symbol(a, Decl(declInput.ts, 6, 23))
>bar : Symbol(bar, Decl(declInput.ts, 0, 0), Decl(declInput.ts, 2, 1))
>b : Symbol(b, Decl(declInput.ts, 6, 36))
>undefined : Symbol(undefined)
>c : Symbol(c, Decl(declInput.ts, 6, 50))
public h(x = 4, y = null, z = '') { x++; }
>h : Symbol(h, Decl(declInput.ts, 6, 65))
>x : Symbol(x, Decl(declInput.ts, 7, 11))
>y : Symbol(y, Decl(declInput.ts, 7, 17))
>z : Symbol(z, Decl(declInput.ts, 7, 27))
>x : Symbol(x, Decl(declInput.ts, 7, 11))
}
+38
View File
@@ -0,0 +1,38 @@
=== tests/cases/compiler/declInput.ts ===
interface bar {
>bar : bar
}
class bar {
>bar : bar
public f() { return ''; }
>f : () => string
>'' : string
public g() { return {a: <bar>null, b: undefined, c: void 4 }; }
>g : () => { a: bar; b: any; c: any; }
>{a: <bar>null, b: undefined, c: void 4 } : { a: bar; b: undefined; c: undefined; }
>a : bar
><bar>null : bar
>bar : bar
>null : null
>b : undefined
>undefined : undefined
>c : undefined
>void 4 : undefined
>4 : number
public h(x = 4, y = null, z = '') { x++; }
>h : (x?: number, y?: any, z?: string) => void
>x : number
>4 : number
>y : any
>null : null
>z : string
>'' : string
>x++ : number
>x : number
}
@@ -1,10 +1,9 @@
tests/cases/conformance/es6/modules/m1.ts(2,22): error TS2652: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
tests/cases/conformance/es6/modules/m1.ts(5,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/conformance/es6/modules/m1.ts(5,11): error TS2652: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
tests/cases/conformance/es6/modules/m2.ts(1,20): error TS2307: Cannot find module 'm1'.
==== tests/cases/conformance/es6/modules/m1.ts (3 errors) ====
==== tests/cases/conformance/es6/modules/m1.ts (2 errors) ====
export default class Decl {
~~~~
@@ -13,8 +12,6 @@ tests/cases/conformance/es6/modules/m2.ts(1,20): error TS2307: Cannot find modul
interface Decl {
~~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
~~~~
!!! error TS2652: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
p1: number;
p2: number;
@@ -1,21 +1,15 @@
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(2,22): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(5,18): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(9,21): error TS2300: Duplicate identifier 'f'.
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(12,18): error TS2300: Duplicate identifier 'f'.
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(37,12): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(41,16): error TS2300: Duplicate identifier 'x'.
==== tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts (6 errors) ====
==== tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts (4 errors) ====
module M {
export interface I { }
~
!!! error TS2518: Only an ambient class can be merged with an interface.
}
module M {
export class I { } // error
~
!!! error TS2518: Only an ambient class can be merged with an interface.
export class I { }
}
module M {
@@ -3,7 +3,7 @@ module M {
export interface I { }
}
module M {
export class I { } // error
export class I { }
}
module M {
@@ -60,7 +60,7 @@ var M;
}
return I;
})();
M.I = I; // error
M.I = I;
})(M || (M = {}));
var M;
(function (M) {
@@ -1,24 +1,16 @@
tests/cases/compiler/file1.ts(2,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/file1.ts(3,7): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/file1.ts(4,7): error TS2300: Duplicate identifier 'C2'.
tests/cases/compiler/file1.ts(5,10): error TS2300: Duplicate identifier 'f'.
tests/cases/compiler/file1.ts(9,12): error TS2300: Duplicate identifier 'x'.
tests/cases/compiler/file2.ts(1,7): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/file2.ts(2,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/file2.ts(3,10): error TS2300: Duplicate identifier 'C2'.
tests/cases/compiler/file2.ts(4,7): error TS2300: Duplicate identifier 'f'.
tests/cases/compiler/file2.ts(7,8): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
tests/cases/compiler/file2.ts(8,16): error TS2300: Duplicate identifier 'x'.
==== tests/cases/compiler/file1.ts (5 errors) ====
==== tests/cases/compiler/file1.ts (3 errors) ====
interface I { }
~
!!! error TS2518: Only an ambient class can be merged with an interface.
class C1 { }
~~
!!! error TS2518: Only an ambient class can be merged with an interface.
class C2 { }
~~
!!! error TS2300: Duplicate identifier 'C2'.
@@ -39,13 +31,9 @@ tests/cases/compiler/file2.ts(8,16): error TS2300: Duplicate identifier 'x'.
}
}
==== tests/cases/compiler/file2.ts (6 errors) ====
==== tests/cases/compiler/file2.ts (4 errors) ====
class I { } // error -- cannot merge interface with non-ambient class
~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface C1 { } // error -- cannot merge interface with non-ambient class
~~
!!! error TS2518: Only an ambient class can be merged with an interface.
function C2() { } // error -- cannot merge function with non-ambient class
~~
!!! error TS2300: Duplicate identifier 'C2'.
@@ -1,13 +1,14 @@
tests/cases/compiler/indexTypeCheck.ts(2,2): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/indexTypeCheck.ts(3,2): error TS1021: An index signature must have a type annotation.
tests/cases/compiler/indexTypeCheck.ts(17,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'.
tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type 'Orange' is not assignable to string index type 'Yellow'.
tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'.
tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter.
tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'.
tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol', or 'any'.
==== tests/cases/compiler/indexTypeCheck.ts (7 errors) ====
==== tests/cases/compiler/indexTypeCheck.ts (8 errors) ====
interface Red {
[n:number]; // ok
~~~~~~~~~~~
@@ -36,6 +37,8 @@ tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression
interface Green {
[n:number]: Orange; // error
~~~~~~~~~~~~~~~~~~~
!!! error TS2413: Numeric index type 'Orange' is not assignable to string index type 'Yellow'.
[s:string]: Yellow; // ok
}
@@ -30,6 +30,8 @@ tests/cases/compiler/intTypeCheck.ts(134,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(134,22): error TS2304: Cannot find name 'i3'.
tests/cases/compiler/intTypeCheck.ts(135,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(142,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(148,5): error TS2322: Type 'boolean' is not assignable to type 'i4'.
Index signature is missing in type 'Boolean'.
tests/cases/compiler/intTypeCheck.ts(148,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(148,22): error TS2304: Cannot find name 'i4'.
tests/cases/compiler/intTypeCheck.ts(149,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
@@ -66,12 +68,14 @@ tests/cases/compiler/intTypeCheck.ts(190,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(190,22): error TS2304: Cannot find name 'i7'.
tests/cases/compiler/intTypeCheck.ts(191,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(198,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
tests/cases/compiler/intTypeCheck.ts(204,5): error TS2322: Type 'boolean' is not assignable to type 'i8'.
Index signature is missing in type 'Boolean'.
tests/cases/compiler/intTypeCheck.ts(204,21): error TS1109: Expression expected.
tests/cases/compiler/intTypeCheck.ts(204,22): error TS2304: Cannot find name 'i8'.
tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
==== tests/cases/compiler/intTypeCheck.ts (61 errors) ====
==== tests/cases/compiler/intTypeCheck.ts (63 errors) ====
interface i1 {
//Property Signatures
p;
@@ -280,6 +284,9 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
//var obj40: i4 = function foo() { };
var obj41: i4 = <i4> anyVar;
var obj42: i4 = new <i4> anyVar;
~~~~~
!!! error TS2322: Type 'boolean' is not assignable to type 'i4'.
!!! error TS2322: Index signature is missing in type 'Boolean'.
~
!!! error TS1109: Expression expected.
~~
@@ -402,6 +409,9 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit
//var obj84: i8 = function foo() { };
var obj85: i8 = <i8> anyVar;
var obj86: i8 = new <i8> anyVar;
~~~~~
!!! error TS2322: Type 'boolean' is not assignable to type 'i8'.
!!! error TS2322: Index signature is missing in type 'Boolean'.
~
!!! error TS1109: Expression expected.
~~
@@ -0,0 +1,76 @@
//// [interfaceClassMerging.ts]
interface Foo {
method(a: number): string;
optionalMethod?(a: number): string;
property: string;
optionalProperty?: string;
}
class Foo {
additionalProperty: string;
additionalMethod(a: number): string {
return this.method(0);
}
}
class Bar extends Foo {
method(a: number) {
return this.optionalProperty;
}
}
var bar = new Bar();
bar.method(0);
bar.optionalMethod(1);
bar.property;
bar.optionalProperty;
bar.additionalProperty;
bar.additionalMethod(2);
var obj: {
method(a: number): string;
property: string;
additionalProperty: string;
additionalMethod(a: number): string;
};
bar = obj;
obj = bar;
//// [interfaceClassMerging.js]
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; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Foo = (function () {
function Foo() {
}
Foo.prototype.additionalMethod = function (a) {
return this.method(0);
};
return Foo;
})();
var Bar = (function (_super) {
__extends(Bar, _super);
function Bar() {
_super.apply(this, arguments);
}
Bar.prototype.method = function (a) {
return this.optionalProperty;
};
return Bar;
})(Foo);
var bar = new Bar();
bar.method(0);
bar.optionalMethod(1);
bar.property;
bar.optionalProperty;
bar.additionalProperty;
bar.additionalMethod(2);
var obj;
bar = obj;
obj = bar;
@@ -0,0 +1,113 @@
=== tests/cases/compiler/interfaceClassMerging.ts ===
interface Foo {
>Foo : Symbol(Foo, Decl(interfaceClassMerging.ts, 0, 0), Decl(interfaceClassMerging.ts, 5, 1))
method(a: number): string;
>method : Symbol(method, Decl(interfaceClassMerging.ts, 0, 15))
>a : Symbol(a, Decl(interfaceClassMerging.ts, 1, 11))
optionalMethod?(a: number): string;
>optionalMethod : Symbol(optionalMethod, Decl(interfaceClassMerging.ts, 1, 30))
>a : Symbol(a, Decl(interfaceClassMerging.ts, 2, 20))
property: string;
>property : Symbol(property, Decl(interfaceClassMerging.ts, 2, 39))
optionalProperty?: string;
>optionalProperty : Symbol(optionalProperty, Decl(interfaceClassMerging.ts, 3, 21))
}
class Foo {
>Foo : Symbol(Foo, Decl(interfaceClassMerging.ts, 0, 0), Decl(interfaceClassMerging.ts, 5, 1))
additionalProperty: string;
>additionalProperty : Symbol(additionalProperty, Decl(interfaceClassMerging.ts, 7, 11))
additionalMethod(a: number): string {
>additionalMethod : Symbol(additionalMethod, Decl(interfaceClassMerging.ts, 8, 31))
>a : Symbol(a, Decl(interfaceClassMerging.ts, 10, 21))
return this.method(0);
>this.method : Symbol(method, Decl(interfaceClassMerging.ts, 0, 15))
>this : Symbol(Foo, Decl(interfaceClassMerging.ts, 0, 0), Decl(interfaceClassMerging.ts, 5, 1))
>method : Symbol(method, Decl(interfaceClassMerging.ts, 0, 15))
}
}
class Bar extends Foo {
>Bar : Symbol(Bar, Decl(interfaceClassMerging.ts, 13, 1))
>Foo : Symbol(Foo, Decl(interfaceClassMerging.ts, 0, 0), Decl(interfaceClassMerging.ts, 5, 1))
method(a: number) {
>method : Symbol(method, Decl(interfaceClassMerging.ts, 15, 23))
>a : Symbol(a, Decl(interfaceClassMerging.ts, 16, 11))
return this.optionalProperty;
>this.optionalProperty : Symbol(Foo.optionalProperty, Decl(interfaceClassMerging.ts, 3, 21))
>this : Symbol(Bar, Decl(interfaceClassMerging.ts, 13, 1))
>optionalProperty : Symbol(Foo.optionalProperty, Decl(interfaceClassMerging.ts, 3, 21))
}
}
var bar = new Bar();
>bar : Symbol(bar, Decl(interfaceClassMerging.ts, 22, 3))
>Bar : Symbol(Bar, Decl(interfaceClassMerging.ts, 13, 1))
bar.method(0);
>bar.method : Symbol(Bar.method, Decl(interfaceClassMerging.ts, 15, 23))
>bar : Symbol(bar, Decl(interfaceClassMerging.ts, 22, 3))
>method : Symbol(Bar.method, Decl(interfaceClassMerging.ts, 15, 23))
bar.optionalMethod(1);
>bar.optionalMethod : Symbol(Foo.optionalMethod, Decl(interfaceClassMerging.ts, 1, 30))
>bar : Symbol(bar, Decl(interfaceClassMerging.ts, 22, 3))
>optionalMethod : Symbol(Foo.optionalMethod, Decl(interfaceClassMerging.ts, 1, 30))
bar.property;
>bar.property : Symbol(Foo.property, Decl(interfaceClassMerging.ts, 2, 39))
>bar : Symbol(bar, Decl(interfaceClassMerging.ts, 22, 3))
>property : Symbol(Foo.property, Decl(interfaceClassMerging.ts, 2, 39))
bar.optionalProperty;
>bar.optionalProperty : Symbol(Foo.optionalProperty, Decl(interfaceClassMerging.ts, 3, 21))
>bar : Symbol(bar, Decl(interfaceClassMerging.ts, 22, 3))
>optionalProperty : Symbol(Foo.optionalProperty, Decl(interfaceClassMerging.ts, 3, 21))
bar.additionalProperty;
>bar.additionalProperty : Symbol(Foo.additionalProperty, Decl(interfaceClassMerging.ts, 7, 11))
>bar : Symbol(bar, Decl(interfaceClassMerging.ts, 22, 3))
>additionalProperty : Symbol(Foo.additionalProperty, Decl(interfaceClassMerging.ts, 7, 11))
bar.additionalMethod(2);
>bar.additionalMethod : Symbol(Foo.additionalMethod, Decl(interfaceClassMerging.ts, 8, 31))
>bar : Symbol(bar, Decl(interfaceClassMerging.ts, 22, 3))
>additionalMethod : Symbol(Foo.additionalMethod, Decl(interfaceClassMerging.ts, 8, 31))
var obj: {
>obj : Symbol(obj, Decl(interfaceClassMerging.ts, 30, 3))
method(a: number): string;
>method : Symbol(method, Decl(interfaceClassMerging.ts, 30, 10))
>a : Symbol(a, Decl(interfaceClassMerging.ts, 31, 11))
property: string;
>property : Symbol(property, Decl(interfaceClassMerging.ts, 31, 30))
additionalProperty: string;
>additionalProperty : Symbol(additionalProperty, Decl(interfaceClassMerging.ts, 32, 21))
additionalMethod(a: number): string;
>additionalMethod : Symbol(additionalMethod, Decl(interfaceClassMerging.ts, 33, 31))
>a : Symbol(a, Decl(interfaceClassMerging.ts, 34, 21))
};
bar = obj;
>bar : Symbol(bar, Decl(interfaceClassMerging.ts, 22, 3))
>obj : Symbol(obj, Decl(interfaceClassMerging.ts, 30, 3))
obj = bar;
>obj : Symbol(obj, Decl(interfaceClassMerging.ts, 30, 3))
>bar : Symbol(bar, Decl(interfaceClassMerging.ts, 22, 3))
@@ -0,0 +1,124 @@
=== tests/cases/compiler/interfaceClassMerging.ts ===
interface Foo {
>Foo : Foo
method(a: number): string;
>method : (a: number) => string
>a : number
optionalMethod?(a: number): string;
>optionalMethod : (a: number) => string
>a : number
property: string;
>property : string
optionalProperty?: string;
>optionalProperty : string
}
class Foo {
>Foo : Foo
additionalProperty: string;
>additionalProperty : string
additionalMethod(a: number): string {
>additionalMethod : (a: number) => string
>a : number
return this.method(0);
>this.method(0) : string
>this.method : (a: number) => string
>this : this
>method : (a: number) => string
>0 : number
}
}
class Bar extends Foo {
>Bar : Bar
>Foo : Foo
method(a: number) {
>method : (a: number) => string
>a : number
return this.optionalProperty;
>this.optionalProperty : string
>this : this
>optionalProperty : string
}
}
var bar = new Bar();
>bar : Bar
>new Bar() : Bar
>Bar : typeof Bar
bar.method(0);
>bar.method(0) : string
>bar.method : (a: number) => string
>bar : Bar
>method : (a: number) => string
>0 : number
bar.optionalMethod(1);
>bar.optionalMethod(1) : string
>bar.optionalMethod : (a: number) => string
>bar : Bar
>optionalMethod : (a: number) => string
>1 : number
bar.property;
>bar.property : string
>bar : Bar
>property : string
bar.optionalProperty;
>bar.optionalProperty : string
>bar : Bar
>optionalProperty : string
bar.additionalProperty;
>bar.additionalProperty : string
>bar : Bar
>additionalProperty : string
bar.additionalMethod(2);
>bar.additionalMethod(2) : string
>bar.additionalMethod : (a: number) => string
>bar : Bar
>additionalMethod : (a: number) => string
>2 : number
var obj: {
>obj : { method(a: number): string; property: string; additionalProperty: string; additionalMethod(a: number): string; }
method(a: number): string;
>method : (a: number) => string
>a : number
property: string;
>property : string
additionalProperty: string;
>additionalProperty : string
additionalMethod(a: number): string;
>additionalMethod : (a: number) => string
>a : number
};
bar = obj;
>bar = obj : { method(a: number): string; property: string; additionalProperty: string; additionalMethod(a: number): string; }
>bar : Bar
>obj : { method(a: number): string; property: string; additionalProperty: string; additionalMethod(a: number): string; }
obj = bar;
>obj = bar : Bar
>obj : { method(a: number): string; property: string; additionalProperty: string; additionalMethod(a: number): string; }
>bar : Bar
@@ -0,0 +1,66 @@
//// [interfaceClassMerging2.ts]
interface Foo {
interfaceFooMethod(): this;
interfaceFooProperty: this;
}
class Foo {
classFooProperty: this;
classFooMethod(): this {
return this;
}
}
interface Bar {
interfaceBarMethod(): this;
interfaceBarProperty: this;
}
class Bar extends Foo {
classBarProperty: this;
classBarMethod(): this {
return this;
}
}
var bar = new Bar();
bar.interfaceBarMethod().interfaceFooMethod().classBarMethod().classFooMethod();
var foo = new Foo();
foo = bar;
//// [interfaceClassMerging2.js]
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; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Foo = (function () {
function Foo() {
}
Foo.prototype.classFooMethod = function () {
return this;
};
return Foo;
})();
var Bar = (function (_super) {
__extends(Bar, _super);
function Bar() {
_super.apply(this, arguments);
}
Bar.prototype.classBarMethod = function () {
return this;
};
return Bar;
})(Foo);
var bar = new Bar();
bar.interfaceBarMethod().interfaceFooMethod().classBarMethod().classFooMethod();
var foo = new Foo();
foo = bar;
@@ -0,0 +1,76 @@
=== tests/cases/compiler/interfaceClassMerging2.ts ===
interface Foo {
>Foo : Symbol(Foo, Decl(interfaceClassMerging2.ts, 0, 0), Decl(interfaceClassMerging2.ts, 3, 1))
interfaceFooMethod(): this;
>interfaceFooMethod : Symbol(interfaceFooMethod, Decl(interfaceClassMerging2.ts, 0, 15))
interfaceFooProperty: this;
>interfaceFooProperty : Symbol(interfaceFooProperty, Decl(interfaceClassMerging2.ts, 1, 31))
}
class Foo {
>Foo : Symbol(Foo, Decl(interfaceClassMerging2.ts, 0, 0), Decl(interfaceClassMerging2.ts, 3, 1))
classFooProperty: this;
>classFooProperty : Symbol(classFooProperty, Decl(interfaceClassMerging2.ts, 5, 11))
classFooMethod(): this {
>classFooMethod : Symbol(classFooMethod, Decl(interfaceClassMerging2.ts, 6, 27))
return this;
>this : Symbol(Foo, Decl(interfaceClassMerging2.ts, 0, 0), Decl(interfaceClassMerging2.ts, 3, 1))
}
}
interface Bar {
>Bar : Symbol(Bar, Decl(interfaceClassMerging2.ts, 11, 1), Decl(interfaceClassMerging2.ts, 17, 1))
interfaceBarMethod(): this;
>interfaceBarMethod : Symbol(interfaceBarMethod, Decl(interfaceClassMerging2.ts, 14, 15))
interfaceBarProperty: this;
>interfaceBarProperty : Symbol(interfaceBarProperty, Decl(interfaceClassMerging2.ts, 15, 31))
}
class Bar extends Foo {
>Bar : Symbol(Bar, Decl(interfaceClassMerging2.ts, 11, 1), Decl(interfaceClassMerging2.ts, 17, 1))
>Foo : Symbol(Foo, Decl(interfaceClassMerging2.ts, 0, 0), Decl(interfaceClassMerging2.ts, 3, 1))
classBarProperty: this;
>classBarProperty : Symbol(classBarProperty, Decl(interfaceClassMerging2.ts, 19, 23))
classBarMethod(): this {
>classBarMethod : Symbol(classBarMethod, Decl(interfaceClassMerging2.ts, 20, 27))
return this;
>this : Symbol(Bar, Decl(interfaceClassMerging2.ts, 11, 1), Decl(interfaceClassMerging2.ts, 17, 1))
}
}
var bar = new Bar();
>bar : Symbol(bar, Decl(interfaceClassMerging2.ts, 28, 3))
>Bar : Symbol(Bar, Decl(interfaceClassMerging2.ts, 11, 1), Decl(interfaceClassMerging2.ts, 17, 1))
bar.interfaceBarMethod().interfaceFooMethod().classBarMethod().classFooMethod();
>bar.interfaceBarMethod().interfaceFooMethod().classBarMethod().classFooMethod : Symbol(Foo.classFooMethod, Decl(interfaceClassMerging2.ts, 6, 27))
>bar.interfaceBarMethod().interfaceFooMethod().classBarMethod : Symbol(Bar.classBarMethod, Decl(interfaceClassMerging2.ts, 20, 27))
>bar.interfaceBarMethod().interfaceFooMethod : Symbol(Foo.interfaceFooMethod, Decl(interfaceClassMerging2.ts, 0, 15))
>bar.interfaceBarMethod : Symbol(Bar.interfaceBarMethod, Decl(interfaceClassMerging2.ts, 14, 15))
>bar : Symbol(bar, Decl(interfaceClassMerging2.ts, 28, 3))
>interfaceBarMethod : Symbol(Bar.interfaceBarMethod, Decl(interfaceClassMerging2.ts, 14, 15))
>interfaceFooMethod : Symbol(Foo.interfaceFooMethod, Decl(interfaceClassMerging2.ts, 0, 15))
>classBarMethod : Symbol(Bar.classBarMethod, Decl(interfaceClassMerging2.ts, 20, 27))
>classFooMethod : Symbol(Foo.classFooMethod, Decl(interfaceClassMerging2.ts, 6, 27))
var foo = new Foo();
>foo : Symbol(foo, Decl(interfaceClassMerging2.ts, 32, 3))
>Foo : Symbol(Foo, Decl(interfaceClassMerging2.ts, 0, 0), Decl(interfaceClassMerging2.ts, 3, 1))
foo = bar;
>foo : Symbol(foo, Decl(interfaceClassMerging2.ts, 32, 3))
>bar : Symbol(bar, Decl(interfaceClassMerging2.ts, 28, 3))
@@ -0,0 +1,83 @@
=== tests/cases/compiler/interfaceClassMerging2.ts ===
interface Foo {
>Foo : Foo
interfaceFooMethod(): this;
>interfaceFooMethod : () => this
interfaceFooProperty: this;
>interfaceFooProperty : this
}
class Foo {
>Foo : Foo
classFooProperty: this;
>classFooProperty : this
classFooMethod(): this {
>classFooMethod : () => this
return this;
>this : this
}
}
interface Bar {
>Bar : Bar
interfaceBarMethod(): this;
>interfaceBarMethod : () => this
interfaceBarProperty: this;
>interfaceBarProperty : this
}
class Bar extends Foo {
>Bar : Bar
>Foo : Foo
classBarProperty: this;
>classBarProperty : this
classBarMethod(): this {
>classBarMethod : () => this
return this;
>this : this
}
}
var bar = new Bar();
>bar : Bar
>new Bar() : Bar
>Bar : typeof Bar
bar.interfaceBarMethod().interfaceFooMethod().classBarMethod().classFooMethod();
>bar.interfaceBarMethod().interfaceFooMethod().classBarMethod().classFooMethod() : Bar
>bar.interfaceBarMethod().interfaceFooMethod().classBarMethod().classFooMethod : () => Bar
>bar.interfaceBarMethod().interfaceFooMethod().classBarMethod() : Bar
>bar.interfaceBarMethod().interfaceFooMethod().classBarMethod : () => Bar
>bar.interfaceBarMethod().interfaceFooMethod() : Bar
>bar.interfaceBarMethod().interfaceFooMethod : () => Bar
>bar.interfaceBarMethod() : Bar
>bar.interfaceBarMethod : () => Bar
>bar : Bar
>interfaceBarMethod : () => Bar
>interfaceFooMethod : () => Bar
>classBarMethod : () => Bar
>classFooMethod : () => Bar
var foo = new Foo();
>foo : Foo
>new Foo() : Foo
>Foo : typeof Foo
foo = bar;
>foo = bar : Bar
>foo : Foo
>bar : Bar
@@ -1,22 +0,0 @@
tests/cases/compiler/interfaceDeclaration2.ts(4,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/interfaceDeclaration2.ts(5,7): error TS2518: Only an ambient class can be merged with an interface.
==== tests/cases/compiler/interfaceDeclaration2.ts (2 errors) ====
interface I1 { }
module I1 { }
interface I2 { }
~~
!!! error TS2518: Only an ambient class can be merged with an interface.
class I2 { }
~~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface I3 { }
function I3() { }
interface I4 { }
var I4:number;
@@ -0,0 +1,26 @@
=== tests/cases/compiler/interfaceDeclaration2.ts ===
interface I1 { }
>I1 : Symbol(I1, Decl(interfaceDeclaration2.ts, 0, 0), Decl(interfaceDeclaration2.ts, 0, 16))
module I1 { }
>I1 : Symbol(I1, Decl(interfaceDeclaration2.ts, 0, 0), Decl(interfaceDeclaration2.ts, 0, 16))
interface I2 { }
>I2 : Symbol(I2, Decl(interfaceDeclaration2.ts, 1, 13), Decl(interfaceDeclaration2.ts, 3, 16))
class I2 { }
>I2 : Symbol(I2, Decl(interfaceDeclaration2.ts, 1, 13), Decl(interfaceDeclaration2.ts, 3, 16))
interface I3 { }
>I3 : Symbol(I3, Decl(interfaceDeclaration2.ts, 4, 12), Decl(interfaceDeclaration2.ts, 6, 16))
function I3() { }
>I3 : Symbol(I3, Decl(interfaceDeclaration2.ts, 4, 12), Decl(interfaceDeclaration2.ts, 6, 16))
interface I4 { }
>I4 : Symbol(I4, Decl(interfaceDeclaration2.ts, 7, 17), Decl(interfaceDeclaration2.ts, 10, 3))
var I4:number;
>I4 : Symbol(I4, Decl(interfaceDeclaration2.ts, 7, 17), Decl(interfaceDeclaration2.ts, 10, 3))
@@ -0,0 +1,26 @@
=== tests/cases/compiler/interfaceDeclaration2.ts ===
interface I1 { }
>I1 : I1
module I1 { }
>I1 : any
interface I2 { }
>I2 : I2
class I2 { }
>I2 : I2
interface I3 { }
>I3 : I3
function I3() { }
>I3 : () => void
interface I4 { }
>I4 : I4
var I4:number;
>I4 : number
@@ -1,67 +0,0 @@
tests/cases/conformance/classes/classDeclarations/file1.ts(11,7): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/conformance/classes/classDeclarations/file1.ts(13,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/conformance/classes/classDeclarations/file1.ts(15,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/conformance/classes/classDeclarations/file1.ts(17,7): error TS2518: Only an ambient class can be merged with an interface.
==== tests/cases/conformance/classes/classDeclarations/file1.ts (4 errors) ====
declare class C1 { }
interface C1 { }
interface C2 { }
declare class C2 { }
class C3 { } // error -- cannot merge non-ambient class and interface
~~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface C3 { } // error -- cannot merge non-ambient class and interface
~~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface C4 { } // error -- cannot merge non-ambient class and interface
~~
!!! error TS2518: Only an ambient class can be merged with an interface.
class C4 { } // error -- cannot merge non-ambient class and interface
~~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface C5 {
x1: number;
}
declare class C5 {
x2: number;
}
interface C5 {
x3: number;
}
interface C5 {
x4: number;
}
// checks if properties actually were merged
var c5 : C5;
c5.x1;
c5.x2;
c5.x3;
c5.x4;
==== tests/cases/conformance/classes/classDeclarations/file2.ts (0 errors) ====
declare class C6 { }
interface C7 { }
==== tests/cases/conformance/classes/classDeclarations/file3.ts (0 errors) ====
interface C6 { }
declare class C7 { }
@@ -11,13 +11,13 @@ interface C2 { }
declare class C2 { }
class C3 { } // error -- cannot merge non-ambient class and interface
class C3 { }
interface C3 { } // error -- cannot merge non-ambient class and interface
interface C3 { }
interface C4 { } // error -- cannot merge non-ambient class and interface
interface C4 { }
class C4 { } // error -- cannot merge non-ambient class and interface
class C4 { }
interface C5 {
x1: number;
@@ -59,12 +59,12 @@ var C3 = (function () {
function C3() {
}
return C3;
})(); // error -- cannot merge non-ambient class and interface
})();
var C4 = (function () {
function C4() {
}
return C4;
})(); // error -- cannot merge non-ambient class and interface
})();
// checks if properties actually were merged
var c5;
c5.x1;
@@ -0,0 +1,96 @@
=== tests/cases/conformance/classes/classDeclarations/file1.ts ===
declare class C1 { }
>C1 : Symbol(C1, Decl(file1.ts, 0, 0), Decl(file1.ts, 2, 20))
interface C1 { }
>C1 : Symbol(C1, Decl(file1.ts, 0, 0), Decl(file1.ts, 2, 20))
interface C2 { }
>C2 : Symbol(C2, Decl(file1.ts, 4, 16), Decl(file1.ts, 6, 16))
declare class C2 { }
>C2 : Symbol(C2, Decl(file1.ts, 4, 16), Decl(file1.ts, 6, 16))
class C3 { }
>C3 : Symbol(C3, Decl(file1.ts, 8, 20), Decl(file1.ts, 10, 12))
interface C3 { }
>C3 : Symbol(C3, Decl(file1.ts, 8, 20), Decl(file1.ts, 10, 12))
interface C4 { }
>C4 : Symbol(C4, Decl(file1.ts, 12, 16), Decl(file1.ts, 14, 16))
class C4 { }
>C4 : Symbol(C4, Decl(file1.ts, 12, 16), Decl(file1.ts, 14, 16))
interface C5 {
>C5 : Symbol(C5, Decl(file1.ts, 16, 12), Decl(file1.ts, 20, 1), Decl(file1.ts, 24, 1), Decl(file1.ts, 28, 1))
x1: number;
>x1 : Symbol(x1, Decl(file1.ts, 18, 14))
}
declare class C5 {
>C5 : Symbol(C5, Decl(file1.ts, 16, 12), Decl(file1.ts, 20, 1), Decl(file1.ts, 24, 1), Decl(file1.ts, 28, 1))
x2: number;
>x2 : Symbol(x2, Decl(file1.ts, 22, 18))
}
interface C5 {
>C5 : Symbol(C5, Decl(file1.ts, 16, 12), Decl(file1.ts, 20, 1), Decl(file1.ts, 24, 1), Decl(file1.ts, 28, 1))
x3: number;
>x3 : Symbol(x3, Decl(file1.ts, 26, 14))
}
interface C5 {
>C5 : Symbol(C5, Decl(file1.ts, 16, 12), Decl(file1.ts, 20, 1), Decl(file1.ts, 24, 1), Decl(file1.ts, 28, 1))
x4: number;
>x4 : Symbol(x4, Decl(file1.ts, 30, 14))
}
// checks if properties actually were merged
var c5 : C5;
>c5 : Symbol(c5, Decl(file1.ts, 35, 3))
>C5 : Symbol(C5, Decl(file1.ts, 16, 12), Decl(file1.ts, 20, 1), Decl(file1.ts, 24, 1), Decl(file1.ts, 28, 1))
c5.x1;
>c5.x1 : Symbol(C5.x1, Decl(file1.ts, 18, 14))
>c5 : Symbol(c5, Decl(file1.ts, 35, 3))
>x1 : Symbol(C5.x1, Decl(file1.ts, 18, 14))
c5.x2;
>c5.x2 : Symbol(C5.x2, Decl(file1.ts, 22, 18))
>c5 : Symbol(c5, Decl(file1.ts, 35, 3))
>x2 : Symbol(C5.x2, Decl(file1.ts, 22, 18))
c5.x3;
>c5.x3 : Symbol(C5.x3, Decl(file1.ts, 26, 14))
>c5 : Symbol(c5, Decl(file1.ts, 35, 3))
>x3 : Symbol(C5.x3, Decl(file1.ts, 26, 14))
c5.x4;
>c5.x4 : Symbol(C5.x4, Decl(file1.ts, 30, 14))
>c5 : Symbol(c5, Decl(file1.ts, 35, 3))
>x4 : Symbol(C5.x4, Decl(file1.ts, 30, 14))
=== tests/cases/conformance/classes/classDeclarations/file2.ts ===
declare class C6 { }
>C6 : Symbol(C6, Decl(file2.ts, 0, 0), Decl(file3.ts, 0, 0))
interface C7 { }
>C7 : Symbol(C7, Decl(file2.ts, 1, 20), Decl(file3.ts, 1, 16))
=== tests/cases/conformance/classes/classDeclarations/file3.ts ===
interface C6 { }
>C6 : Symbol(C6, Decl(file2.ts, 0, 0), Decl(file3.ts, 0, 0))
declare class C7 { }
>C7 : Symbol(C7, Decl(file2.ts, 1, 20), Decl(file3.ts, 1, 16))
@@ -0,0 +1,96 @@
=== tests/cases/conformance/classes/classDeclarations/file1.ts ===
declare class C1 { }
>C1 : C1
interface C1 { }
>C1 : C1
interface C2 { }
>C2 : C2
declare class C2 { }
>C2 : C2
class C3 { }
>C3 : C3
interface C3 { }
>C3 : C3
interface C4 { }
>C4 : C4
class C4 { }
>C4 : C4
interface C5 {
>C5 : C5
x1: number;
>x1 : number
}
declare class C5 {
>C5 : C5
x2: number;
>x2 : number
}
interface C5 {
>C5 : C5
x3: number;
>x3 : number
}
interface C5 {
>C5 : C5
x4: number;
>x4 : number
}
// checks if properties actually were merged
var c5 : C5;
>c5 : C5
>C5 : C5
c5.x1;
>c5.x1 : number
>c5 : C5
>x1 : number
c5.x2;
>c5.x2 : number
>c5 : C5
>x2 : number
c5.x3;
>c5.x3 : number
>c5 : C5
>x3 : number
c5.x4;
>c5.x4 : number
>c5 : C5
>x4 : number
=== tests/cases/conformance/classes/classDeclarations/file2.ts ===
declare class C6 { }
>C6 : C6
interface C7 { }
>C7 : C7
=== tests/cases/conformance/classes/classDeclarations/file3.ts ===
interface C6 { }
>C6 : C6
declare class C7 { }
>C7 : C7
@@ -0,0 +1,38 @@
//// [tests/cases/compiler/moduleMergeConstructor.ts] ////
//// [foo.d.ts]
declare module "foo" {
export class Foo {
constructor();
method1(): any;
}
}
//// [foo-ext.d.ts]
declare module "foo" {
export interface Foo {
method2(): any;
}
}
//// [index.ts]
import * as foo from "foo";
class Test {
bar: foo.Foo;
constructor() {
this.bar = new foo.Foo();
}
}
//// [index.js]
define(["require", "exports", "foo"], function (require, exports, foo) {
var Test = (function () {
function Test() {
this.bar = new foo.Foo();
}
return Test;
})();
});
@@ -0,0 +1,45 @@
=== tests/cases/compiler/foo.d.ts ===
declare module "foo" {
export class Foo {
>Foo : Symbol(Foo, Decl(foo.d.ts, 1, 22), Decl(foo-ext.d.ts, 0, 22))
constructor();
method1(): any;
>method1 : Symbol(method1, Decl(foo.d.ts, 3, 22))
}
}
=== tests/cases/compiler/foo-ext.d.ts ===
declare module "foo" {
export interface Foo {
>Foo : Symbol(Foo, Decl(foo.d.ts, 1, 22), Decl(foo-ext.d.ts, 0, 22))
method2(): any;
>method2 : Symbol(method2, Decl(foo-ext.d.ts, 1, 26))
}
}
=== tests/cases/compiler/index.ts ===
import * as foo from "foo";
>foo : Symbol(foo, Decl(index.ts, 0, 6))
class Test {
>Test : Symbol(Test, Decl(index.ts, 0, 27))
bar: foo.Foo;
>bar : Symbol(bar, Decl(index.ts, 2, 12))
>foo : Symbol(foo, Decl(index.ts, 0, 6))
>Foo : Symbol(foo.Foo, Decl(foo.d.ts, 1, 22), Decl(foo-ext.d.ts, 0, 22))
constructor() {
this.bar = new foo.Foo();
>this.bar : Symbol(bar, Decl(index.ts, 2, 12))
>this : Symbol(Test, Decl(index.ts, 0, 27))
>bar : Symbol(bar, Decl(index.ts, 2, 12))
>foo.Foo : Symbol(foo.Foo, Decl(foo.d.ts, 1, 22), Decl(foo-ext.d.ts, 0, 22))
>foo : Symbol(foo, Decl(index.ts, 0, 6))
>Foo : Symbol(foo.Foo, Decl(foo.d.ts, 1, 22), Decl(foo-ext.d.ts, 0, 22))
}
}
@@ -0,0 +1,47 @@
=== tests/cases/compiler/foo.d.ts ===
declare module "foo" {
export class Foo {
>Foo : Foo
constructor();
method1(): any;
>method1 : () => any
}
}
=== tests/cases/compiler/foo-ext.d.ts ===
declare module "foo" {
export interface Foo {
>Foo : Foo
method2(): any;
>method2 : () => any
}
}
=== tests/cases/compiler/index.ts ===
import * as foo from "foo";
>foo : typeof foo
class Test {
>Test : Test
bar: foo.Foo;
>bar : foo.Foo
>foo : any
>Foo : foo.Foo
constructor() {
this.bar = new foo.Foo();
>this.bar = new foo.Foo() : foo.Foo
>this.bar : foo.Foo
>this : this
>bar : foo.Foo
>new foo.Foo() : foo.Foo
>foo.Foo : typeof foo.Foo
>foo : typeof foo
>Foo : typeof foo.Foo
}
}
@@ -11,13 +11,9 @@ tests/cases/compiler/nameCollisions.ts(33,11): error TS2300: Duplicate identifie
tests/cases/compiler/nameCollisions.ts(34,14): error TS2300: Duplicate identifier 'C'.
tests/cases/compiler/nameCollisions.ts(36,14): error TS2300: Duplicate identifier 'C2'.
tests/cases/compiler/nameCollisions.ts(37,11): error TS2300: Duplicate identifier 'C2'.
tests/cases/compiler/nameCollisions.ts(42,11): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/nameCollisions.ts(43,15): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/nameCollisions.ts(45,15): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/nameCollisions.ts(46,11): error TS2518: Only an ambient class can be merged with an interface.
==== tests/cases/compiler/nameCollisions.ts (17 errors) ====
==== tests/cases/compiler/nameCollisions.ts (13 errors) ====
module T {
var x = 2;
~
@@ -86,16 +82,8 @@ tests/cases/compiler/nameCollisions.ts(46,11): error TS2518: Only an ambient cla
interface fi { } // ok
class cli { }
~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface cli { } // error
~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
interface cli { }
interface cli2 { }
~~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
class cli2 { } // error
~~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
class cli2 { }
}
+3 -3
View File
@@ -41,10 +41,10 @@ module T {
interface fi { } // ok
class cli { }
interface cli { } // error
interface cli { }
interface cli2 { }
class cli2 { } // error
class cli2 { }
}
//// [nameCollisions.js]
@@ -102,5 +102,5 @@ var T;
function cli2() {
}
return cli2;
})(); // error
})();
})(T || (T = {}));
@@ -1,13 +1,10 @@
tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(2,7): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts(8,3): error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'.
Property 'raw' is missing in type '{}'.
==== tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts (2 errors) ====
==== tests/cases/compiler/templateStringsArrayTypeDefinedInES5Mode.ts (1 errors) ====
class TemplateStringsArray {
~~~~~~~~~~~~~~~~~~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
}
function f(x: TemplateStringsArray, y: number, z: number) {
@@ -1,13 +1,10 @@
tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts(2,7): error TS2518: Only an ambient class can be merged with an interface.
tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts(8,3): error TS2345: Argument of type '{}' is not assignable to parameter of type 'TemplateStringsArray'.
Property 'raw' is missing in type '{}'.
==== tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts (2 errors) ====
==== tests/cases/compiler/templateStringsArrayTypeRedefinedInES6Mode.ts (1 errors) ====
class TemplateStringsArray {
~~~~~~~~~~~~~~~~~~~~
!!! error TS2518: Only an ambient class can be merged with an interface.
}
function f(x: TemplateStringsArray, y: number, z: number) {
@@ -0,0 +1,8 @@
declare class C {
baz(): any;
foo(n: number): any;
}
interface C {
foo(n: number): any;
bar(): any;
}
@@ -0,0 +1,5 @@
var obj: Object;
if (ArrayBuffer.isView(obj)) {
// isView should be a guard that narrows type to ArrayBufferView.
var ab: ArrayBufferView = obj;
}
@@ -5,3 +5,7 @@ x = y; // Error
y = x; // Ok because index signature type is any
x = z; // Error
z = x; // Ok because index signature type is any
y = "foo"; // Error
z = "foo"; // OK, string has numeric indexer
z = false; // Error
+2 -2
View File
@@ -1,13 +1,13 @@
// Checking class with other things in type space not value space
// class then interface
class c11 { // error
class c11 {
foo() {
return 1;
}
}
interface c11 { // error
interface c11 {
bar(): void;
}
@@ -9,11 +9,11 @@ interface i {
}
// interface then class
interface i2 { // error
interface i2 {
foo(): void;
}
class i2 { // error
class i2 {
bar() {
return 1;
}
@@ -2,7 +2,7 @@ module M {
export interface I { }
}
module M {
export class I { } // error
export class I { }
}
module M {
@@ -0,0 +1,39 @@
interface Foo {
method(a: number): string;
optionalMethod?(a: number): string;
property: string;
optionalProperty?: string;
}
class Foo {
additionalProperty: string;
additionalMethod(a: number): string {
return this.method(0);
}
}
class Bar extends Foo {
method(a: number) {
return this.optionalProperty;
}
}
var bar = new Bar();
bar.method(0);
bar.optionalMethod(1);
bar.property;
bar.optionalProperty;
bar.additionalProperty;
bar.additionalMethod(2);
var obj: {
method(a: number): string;
property: string;
additionalProperty: string;
additionalMethod(a: number): string;
};
bar = obj;
obj = bar;
@@ -0,0 +1,35 @@
interface Foo {
interfaceFooMethod(): this;
interfaceFooProperty: this;
}
class Foo {
classFooProperty: this;
classFooMethod(): this {
return this;
}
}
interface Bar {
interfaceBarMethod(): this;
interfaceBarProperty: this;
}
class Bar extends Foo {
classBarProperty: this;
classBarMethod(): this {
return this;
}
}
var bar = new Bar();
bar.interfaceBarMethod().interfaceFooMethod().classBarMethod().classFooMethod();
var foo = new Foo();
foo = bar;
@@ -0,0 +1,26 @@
// @module: amd
// @filename: foo.d.ts
declare module "foo" {
export class Foo {
constructor();
method1(): any;
}
}
// @filename: foo-ext.d.ts
declare module "foo" {
export interface Foo {
method2(): any;
}
}
// @filename: index.ts
import * as foo from "foo";
class Test {
bar: foo.Foo;
constructor() {
this.bar = new foo.Foo();
}
}
+2 -2
View File
@@ -40,8 +40,8 @@ module T {
interface fi { } // ok
class cli { }
interface cli { } // error
interface cli { }
interface cli2 { }
class cli2 { } // error
class cli2 { }
}
@@ -1,12 +1,12 @@
class C { foo: string; }
interface C { foo: string; } // error
interface C { foo: string; }
module M {
class D {
bar: string;
}
interface D { // error
interface D {
bar: string;
}
}
@@ -10,13 +10,13 @@ interface C2 { }
declare class C2 { }
class C3 { } // error -- cannot merge non-ambient class and interface
class C3 { }
interface C3 { } // error -- cannot merge non-ambient class and interface
interface C3 { }
interface C4 { } // error -- cannot merge non-ambient class and interface
interface C4 { }
class C4 { } // error -- cannot merge non-ambient class and interface
class C4 { }
interface C5 {
x1: number;