Merge branch 'master' into interfaceFixes

This commit is contained in:
Arthur Ozga
2016-12-14 09:35:09 -08:00
73 changed files with 1798 additions and 390 deletions

View File

@@ -0,0 +1,15 @@
// @declaration: true
// @filename: db.d.ts
declare namespace Db {
export import Types = Db;
}
export = Db;
// @filename: app.ts
import * as Db from "./db"
export function foo() {
return new Object()
}

View File

@@ -0,0 +1,42 @@
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @target: es5
// @filename: aux.ts
export class SomeClass {
field: string;
}
// @filename: aux1.ts
export class SomeClass1 {
field: string;
}
// @filename: aux2.ts
export class SomeClass2 {
field: string;
}
// @filename: main.ts
import { SomeClass } from './aux';
import { SomeClass1 } from './aux1';
function annotation(): ClassDecorator {
return (target: any): void => { };
}
function annotation1(): MethodDecorator {
return (target: any): void => { };
}
@annotation()
export class ClassA {
array: SomeClass[];
constructor(...init: SomeClass[]) {
this.array = init;
}
@annotation1()
foo(... args: SomeClass1[]) {
}
}

View File

@@ -0,0 +1,3 @@
// @noImplicitAny: true
({ a: [], ...(null as any) });
let x: any;

View File

@@ -0,0 +1,9 @@
// @importHelpers: true
// @target: es5
// @module: commonjs
// @moduleResolution: classic
// @filename: declaration.d.ts
export declare class D {
}
export declare class E extends D {
}

View File

@@ -0,0 +1,14 @@
// @strictNullChecks: true
interface CSSProps {
color?: string
}
interface NestedCSSProps {
nested?: NestedSelector
}
interface NestedSelector {
prop: CSSProps;
}
let stylen: NestedCSSProps = {
nested: { prop: { colour: 'red' } }
}

View File

@@ -0,0 +1,13 @@
// @target: es5
function baz(x: any) {
return [[x, x]];
}
function foo(set: any) {
for (const [value, i] of baz(set.values)) {
const bar: any = [];
(() => bar);
set.values.push(...[]);
}
};

View File

@@ -0,0 +1,5 @@
// @noImplicitAny: true
let additional = [];
for (const subcomponent of [1, 2, 3]) {
additional = [...additional, subcomponent];
}

View File

@@ -0,0 +1,4 @@
// @module: system
export const test = "TEST";
//some comment

View File

@@ -0,0 +1,14 @@
// @noImplicitReferences: true
// This tests that augmenting an untyped module is forbidden even in an ambient context. Contrast with `moduleAugmentationInDependency.ts`.
// @Filename: /node_modules/augmenter/index.d.ts
declare module "js" {
export const j: number;
}
export {};
// @Filename: /node_modules/js/index.js
This file is not processed.
// @Filename: /a.ts
import { } from "augmenter";

View File

@@ -0,0 +1,32 @@
// @target:es5
// @experimentaldecorators: true
// @emitdecoratormetadata: true
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
class A {
@dec get x() { return 0; }
set x(value: number) { }
}
class B {
get x() { return 0; }
@dec set x(value: number) { }
}
class C {
@dec set x(value: number) { }
get x() { return 0; }
}
class D {
set x(value: number) { }
@dec get x() { return 0; }
}
class E {
@dec get x() { return 0; }
}
class F {
@dec set x(value: number) { }
}

View File

@@ -0,0 +1,18 @@
// @target: es5
// @module: commonjs
// @experimentaldecorators: true
// @emitdecoratormetadata: true
declare var dec: any;
@dec
class A {
}
@dec
class B {
constructor(x: number) {}
}
@dec
class C extends A {
}

View File

@@ -19,12 +19,14 @@ var v01: Pick<Pick<T, keyof T>, keyof T>;
var v02: TP;
var v02: { [P in keyof T]?: T[P] };
var v02: Partial<T>;
var v02: Pick<TP, keyof T>;
var v02: { [P in keyof TP]: TP[P] }
var v02: Pick<TP, keyof TP>;
var v03: TR;
var v03: { readonly [P in keyof T]: T[P] };
var v03: Readonly<T>;
var v03: Pick<TR, keyof T>;
var v03: { [P in keyof TR]: TR[P] }
var v03: Pick<TR, keyof TR>;
var v04: TPR;
var v04: { readonly [P in keyof T]?: T[P] };
@@ -32,6 +34,7 @@ var v04: Partial<TR>;
var v04: Readonly<TP>;
var v04: Partial<Readonly<T>>;
var v04: Readonly<Partial<T>>;
var v04: { [P in keyof TPR]: TPR[P] }
var v04: Pick<TPR, keyof T>;
type Boxified<T> = { [P in keyof T]: { x: T[P] } };
@@ -55,12 +58,14 @@ var b01: Pick<Pick<B, keyof B>, keyof B>;
var b02: BP;
var b02: { [P in keyof B]?: B[P] };
var b02: Partial<B>;
var b02: Pick<BP, keyof B>;
var b02: { [P in keyof BP]: BP[P] }
var b02: Pick<BP, keyof BP>;
var b03: BR;
var b03: { readonly [P in keyof B]: B[P] };
var b03: Readonly<B>;
var b03: Pick<BR, keyof B>;
var b03: { [P in keyof BR]: BR[P] }
var b03: Pick<BR, keyof BR>;
var b04: BPR;
var b04: { readonly [P in keyof B]?: B[P] };
@@ -68,4 +73,5 @@ var b04: Partial<BR>;
var b04: Readonly<BP>;
var b04: Partial<Readonly<B>>;
var b04: Readonly<Partial<B>>;
var b04: Pick<BPR, keyof B>;
var b04: { [P in keyof BPR]: BPR[P] }
var b04: Pick<BPR, keyof BPR>;

View File

@@ -105,6 +105,14 @@
//// * second time information about the param again
//// */
////function /*l*/l(param1: string) { /*9*/param1 = "hello"; }
//// /**
//// * This is firstLine
//// This is second Line
//// [1]: third * line
//// @param param1 first Line text
//// second line text
//// */
////function /*m*/m(param1: string) { /*10*/param1 = "hello"; }
verify.quickInfos({
a: ["var a: string", "This is firstLine\nThis is second Line\n\nThis is fourth Line"],
@@ -136,5 +144,8 @@ verify.quickInfos({
8: ["(parameter) param1: string", "hello "],
l: ["function l(param1: string): void", "This is firstLine\nThis is second Line"],
9: ["(parameter) param1: string", "first Line text\nblank line that shouldnt be shown when starting this \nsecond time information about the param again"]
9: ["(parameter) param1: string", "first Line text\nblank line that shouldnt be shown when starting this \nsecond time information about the param again"],
m: ["function m(param1: string): void", "This is firstLine\nThis is second Line\n[1]: third * line"],
10: ["(parameter) param1: string", "first Line text\nsecond line text"]
});

View File

@@ -30,6 +30,7 @@ goTo.marker('1');
verify.completionListContains("constructor");
verify.completionListContains("param");
verify.completionListContains("type");
verify.completionListContains("method");
goTo.marker('2');
verify.completionListContains("constructor");