Add fourslash tests and update missed baselines

This commit is contained in:
Nathan Shively-Sanders
2018-01-04 10:55:41 -08:00
parent b9fb4cce88
commit cc7710c71c
5 changed files with 81 additions and 14 deletions

View File

@@ -310,17 +310,11 @@ declare type Spec<T> = {
*/
declare function applySpec<T>(obj: Spec<T>): (...args: any[]) => T;
declare var g1: (...args: any[]) => {
sum: number;
nested: {
mul: string;
};
sum: {};
nested: {};
};
declare var g2: (...args: any[]) => {
foo: {
bar: {
baz: boolean;
};
};
foo: {};
};
declare const foo: <T>(object: T, partial: Partial<T>) => T;
declare let o: {

View File

@@ -1105,7 +1105,7 @@ declare var hashOfEmpty1: {
test: {};
};
declare var hashOfEmpty2: {
test: boolean;
test: {};
};
interface Options1<Data, Computed> {
data?: Data;

View File

@@ -462,8 +462,8 @@ declare function defineProps<T, U>(obj: T, descs: PropDescMap<U> & ThisType<T>):
declare let p10: Point & Record<"foo", number>;
declare let p11: Point & Record<"bar", number>;
declare let p12: Point & {
foo: number;
bar: number;
foo: {};
bar: {};
};
declare type Accessors<T> = {
[K in keyof T]: (() => T[K]) | Computed<T[K]>;
@@ -487,6 +487,6 @@ declare let vue: {
} & {
f(x: string): number;
} & {
test: number;
hello: string;
test: {};
hello: {};
};

View File

@@ -0,0 +1,17 @@
/// <reference path="fourslash.ts" />
// @Filename: test.ts
//// interface A { a: A }
//// declare let a: A;
//// type Deep<T> = { [K in keyof T]: Deep<T[K]> }
//// declare function foo<T>(deep: Deep<T>): T;
//// const out = foo(a);
//// out./*1*/a
//// out.a./*2*/a
//// out.a.a./*3*/a
goTo.marker('1');
verify.completionListCount(1);
goTo.marker('2');
verify.completionListCount(1);
goTo.marker('3');
verify.completionListCount(1);

View File

@@ -0,0 +1,56 @@
/// <reference path="fourslash.ts" />
// @Filename: test.ts
//// interface A { a: A }
//// declare let a: A;
//// type Deep<T> = { [K in keyof T]: Deep<T[K]> }
//// declare function foo<T>(deep: Deep<T>): T;
//// const out/*1*/ = foo/*2*/(a);
//// out.a/*3*/
//// out.a.a/*4*/
//// out.a.a.a.a.a.a.a/*5*/
////
//// interface B { [s: string]: B }
//// declare let b: B;
//// const oub/*6*/ = foo/*7*/(b);
//// oub.b/*8*/
//// oub.b.b/*9*/
//// oub.b.a.n.a.n.a/*10*/
verify.quickInfoAt('1', `const out: {
a: {};
}`);
verify.quickInfoAt('2', `function foo<{
a: {};
}>(deep: Deep<{
a: {};
}>): {
a: {};
}`);
verify.quickInfoAt('3', `(property) a: {
a: {};
}`);
verify.quickInfoAt('4', `(property) a: {
a: {};
}`);
verify.quickInfoAt('5', `(property) a: {
a: {};
}`);
verify.quickInfoAt('6', `const oub: {
[x: string]: {};
}`);
verify.quickInfoAt('7', `function foo<{
[x: string]: {};
}>(deep: Deep<{
[x: string]: {};
}>): {
[x: string]: {};
}`);
verify.quickInfoAt('8', `{
[x: string]: {};
}`);
verify.quickInfoAt('9', `{
[x: string]: {};
}`);
verify.quickInfoAt('10', `{
[x: string]: {};
}`);