Test:spelling suggestions for more types

Test spelling suggestions for primitives, unions/intersections and type
parameters with constraints.
This commit is contained in:
Nathan Shively-Sanders 2017-06-30 10:12:02 -07:00
parent e0bf267029
commit abec46ce48
6 changed files with 36 additions and 18 deletions

View file

@ -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(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(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) ====
@ -87,7 +87,7 @@ tests/cases/conformance/es6/templates/taggedTemplateStringsWithOverloadResolutio
function fn5() { return undefined; }
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) }`;

View file

@ -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(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(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)
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)
let f = <BigGreeter ref={x => x.notARealProperty} />;
~~~~~~~~~~~~~~~~

View file

@ -8,7 +8,7 @@ tests/cases/compiler/unionPropertyExistence.ts(32,4): error TS2339: Property 'on
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'.
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'.
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'.
@ -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'.
ab.notInB;
~~~~~~
!!! error TS2339: Property 'notInB' does not exist on type 'AB'.
!!! error TS2339: Property 'notInB' does not exist on type 'B'.
!!! error TS2551: Property 'notInB' does not exist on type 'AB'. Did you mean 'notInC'?
!!! error TS2551: Property 'notInB' does not exist on type 'B'.
abc.notInB;
~~~~~~
!!! error TS2339: Property 'notInB' does not exist on type 'ABC'.

View file

@ -1,15 +1,9 @@
/// <reference path='fourslash.ts' />
////[|class C {
//// state = 'hi'
//// doStuff() {
//// this.start;
//// }
////[|function foo(s: string) {
//// return s.toStrang();
////}|]
verify.rangeAfterCodeFix(`class C {
state = 'hi'
doStuff() {
this.state;
}
}`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 2);
verify.rangeAfterCodeFix(`function foo(s: string) {
return s.toString();
}`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 0);

View 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);

View 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);