Test:spelling suggestions for more types
Test spelling suggestions for primitives, unions/intersections and type parameters with constraints.
This commit is contained in:
parent
e0bf267029
commit
abec46ce48
6 changed files with 36 additions and 18 deletions
|
@ -3,7 +3,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio
|
||||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(44,1): error TS2554: Expected 2-4 arguments, but got 1.
|
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(44,1): error TS2554: Expected 2-4 arguments, but got 1.
|
||||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(62,9): error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'.
|
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(62,9): error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'.
|
||||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(63,18): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'.
|
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(63,18): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'.
|
||||||
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(69,18): error TS2339: Property 'toFixed' does not exist on type 'string'.
|
tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts(69,18): error TS2551: Property 'toFixed' does not exist on type 'string'. Did you mean 'fixed'?
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts (6 errors) ====
|
==== tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolution3_ES6.ts (6 errors) ====
|
||||||
|
@ -87,7 +87,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio
|
||||||
function fn5() { return undefined; }
|
function fn5() { return undefined; }
|
||||||
fn5 `${ (n) => n.toFixed() }`; // will error; 'n' should have type 'string'.
|
fn5 `${ (n) => n.toFixed() }`; // will error; 'n' should have type 'string'.
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
!!! error TS2339: Property 'toFixed' does not exist on type 'string'.
|
!!! error TS2551: Property 'toFixed' does not exist on type 'string'. Did you mean 'fixed'?
|
||||||
fn5 `${ (n) => n.substr(0) }`;
|
fn5 `${ (n) => n.substr(0) }`;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
tests/cases/conformance/jsx/file.tsx(19,16): error TS2559: Type '{ ref: "myRef"; }' has no properties in common with type 'IntrinsicAttributes & { name?: string; }'.
|
tests/cases/conformance/jsx/file.tsx(19,16): error TS2559: Type '{ ref: "myRef"; }' has no properties in common with type 'IntrinsicAttributes & { name?: string; }'.
|
||||||
tests/cases/conformance/jsx/file.tsx(25,42): error TS2339: Property 'subtr' does not exist on type 'string'.
|
tests/cases/conformance/jsx/file.tsx(25,42): error TS2551: Property 'subtr' does not exist on type 'string'. Did you mean 'substr'?
|
||||||
tests/cases/conformance/jsx/file.tsx(27,33): error TS2339: Property 'notARealProperty' does not exist on type 'BigGreeter'.
|
tests/cases/conformance/jsx/file.tsx(27,33): error TS2339: Property 'notARealProperty' does not exist on type 'BigGreeter'.
|
||||||
tests/cases/conformance/jsx/file.tsx(35,26): error TS2339: Property 'propertyNotOnHtmlDivElement' does not exist on type 'HTMLDivElement'.
|
tests/cases/conformance/jsx/file.tsx(35,26): error TS2339: Property 'propertyNotOnHtmlDivElement' does not exist on type 'HTMLDivElement'.
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ tests/cases/conformance/jsx/file.tsx(35,26): error TS2339: Property 'propertyNot
|
||||||
// Error ('subtr' not on string)
|
// Error ('subtr' not on string)
|
||||||
let e = <BigGreeter ref={x => x.greeting.subtr(10)} />;
|
let e = <BigGreeter ref={x => x.greeting.subtr(10)} />;
|
||||||
~~~~~
|
~~~~~
|
||||||
!!! error TS2339: Property 'subtr' does not exist on type 'string'.
|
!!! error TS2551: Property 'subtr' does not exist on type 'string'. Did you mean 'substr'?
|
||||||
// Error (ref callback is contextually typed)
|
// Error (ref callback is contextually typed)
|
||||||
let f = <BigGreeter ref={x => x.notARealProperty} />;
|
let f = <BigGreeter ref={x => x.notARealProperty} />;
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
|
@ -8,7 +8,7 @@ tests/cases/compiler/unionPropertyExistence.ts(32,4): error TS2339: Property 'on
|
||||||
Property 'onlyInB' does not exist on type 'A'.
|
Property 'onlyInB' does not exist on type 'A'.
|
||||||
tests/cases/compiler/unionPropertyExistence.ts(35,5): error TS2339: Property 'notInC' does not exist on type 'ABC'.
|
tests/cases/compiler/unionPropertyExistence.ts(35,5): error TS2339: Property 'notInC' does not exist on type 'ABC'.
|
||||||
Property 'notInC' does not exist on type 'C'.
|
Property 'notInC' does not exist on type 'C'.
|
||||||
tests/cases/compiler/unionPropertyExistence.ts(36,4): error TS2339: Property 'notInB' does not exist on type 'AB'.
|
tests/cases/compiler/unionPropertyExistence.ts(36,4): error TS2551: Property 'notInB' does not exist on type 'AB'. Did you mean 'notInC'?
|
||||||
Property 'notInB' does not exist on type 'B'.
|
Property 'notInB' does not exist on type 'B'.
|
||||||
tests/cases/compiler/unionPropertyExistence.ts(37,5): error TS2339: Property 'notInB' does not exist on type 'ABC'.
|
tests/cases/compiler/unionPropertyExistence.ts(37,5): error TS2339: Property 'notInB' does not exist on type 'ABC'.
|
||||||
Property 'notInB' does not exist on type 'B'.
|
Property 'notInB' does not exist on type 'B'.
|
||||||
|
@ -69,8 +69,8 @@ tests/cases/compiler/unionPropertyExistence.ts(40,5): error TS2339: Property 'in
|
||||||
!!! error TS2339: Property 'notInC' does not exist on type 'C'.
|
!!! error TS2339: Property 'notInC' does not exist on type 'C'.
|
||||||
ab.notInB;
|
ab.notInB;
|
||||||
~~~~~~
|
~~~~~~
|
||||||
!!! error TS2339: Property 'notInB' does not exist on type 'AB'.
|
!!! error TS2551: Property 'notInB' does not exist on type 'AB'. Did you mean 'notInC'?
|
||||||
!!! error TS2339: Property 'notInB' does not exist on type 'B'.
|
!!! error TS2551: Property 'notInB' does not exist on type 'B'.
|
||||||
abc.notInB;
|
abc.notInB;
|
||||||
~~~~~~
|
~~~~~~
|
||||||
!!! error TS2339: Property 'notInB' does not exist on type 'ABC'.
|
!!! error TS2339: Property 'notInB' does not exist on type 'ABC'.
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
/// <reference path='fourslash.ts' />
|
/// <reference path='fourslash.ts' />
|
||||||
|
|
||||||
////[|class C {
|
////[|function foo(s: string) {
|
||||||
//// state = 'hi'
|
//// return s.toStrang();
|
||||||
//// doStuff() {
|
|
||||||
//// this.start;
|
|
||||||
//// }
|
|
||||||
////}|]
|
////}|]
|
||||||
|
|
||||||
verify.rangeAfterCodeFix(`class C {
|
verify.rangeAfterCodeFix(`function foo(s: string) {
|
||||||
state = 'hi'
|
return s.toString();
|
||||||
doStuff() {
|
}`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 0);
|
||||||
this.state;
|
|
||||||
}
|
|
||||||
}`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 2);
|
|
||||||
|
|
9
tests/cases/fourslash/codeFixCorrectSpelling2.ts
Normal file
9
tests/cases/fourslash/codeFixCorrectSpelling2.ts
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/// <reference path='fourslash.ts' />
|
||||||
|
|
||||||
|
////[|function foo<T extends number | string>(x: T) {
|
||||||
|
//// return x.toStrang();
|
||||||
|
////}|]
|
||||||
|
|
||||||
|
verify.rangeAfterCodeFix(`function foo<T extends number | string>(x: T) {
|
||||||
|
return x.toString();
|
||||||
|
}`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 0);
|
15
tests/cases/fourslash/codeFixCorrectSpelling3.ts
Normal file
15
tests/cases/fourslash/codeFixCorrectSpelling3.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/// <reference path='fourslash.ts' />
|
||||||
|
|
||||||
|
////[|class C {
|
||||||
|
//// state = 'hi'
|
||||||
|
//// doStuff() {
|
||||||
|
//// this.start;
|
||||||
|
//// }
|
||||||
|
////}|]
|
||||||
|
|
||||||
|
verify.rangeAfterCodeFix(`class C {
|
||||||
|
state = 'hi'
|
||||||
|
doStuff() {
|
||||||
|
this.state;
|
||||||
|
}
|
||||||
|
}`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 2);
|
Loading…
Reference in a new issue