Skip to content

Commit 09548f2

Browse files
committed
Use expect-type
1 parent 17eeb95 commit 09548f2

3 files changed

Lines changed: 22 additions & 7 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"eslint-plugin-node": "^11.1.0",
7979
"eslint-plugin-prettier": "^4.0.0",
8080
"eslint-plugin-qunit": "^7.3.4",
81+
"expect-type": "^0.15.0",
8182
"loader.js": "^4.7.0",
8283
"npm-run-all": "^4.1.5",
8384
"prettier": "^2.6.0",

type-tests/the-tests.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,53 @@ import {
88
w,
99
} from '@ember/string';
1010

11+
import { expectTypeOf } from 'expect-type';
12+
1113
// @ts-expect-error
1214
dasherize();
13-
dasherize('blue man group'); // $ExpectType string
1415
// @ts-expect-error
1516
dasherize('', '');
1617

18+
expectTypeOf(dasherize('blue man group')).toBeString()
19+
1720
// @ts-expect-error
1821
camelize();
19-
camelize('blue man group'); // $ExpectType string
2022
// @ts-expect-error
2123
camelize('', '');
2224

25+
expectTypeOf(camelize('blue man group')).toBeString();
26+
2327
// @ts-expect-error
2428
decamelize();
25-
decamelize('blue man group'); // $ExpectType string
2629
// @ts-expect-error
2730
decamelize('', '');
2831

32+
expectTypeOf(decamelize('blue man group')).toBeString();
33+
2934
// @ts-expect-error
3035
underscore();
31-
underscore('blue man group'); // $ExpectType string
3236
// @ts-expect-error
3337
underscore('', '');
3438

39+
expectTypeOf(underscore('blue man group')).toBeString();
40+
3541
// @ts-expect-error
3642
w();
37-
w('blue man group'); // $ExpectType string[]
3843
// @ts-expect-error
3944
w('', '');
4045

46+
expectTypeOf(w('blue man group')).toMatchTypeOf<string[]>();
47+
4148
// @ts-expect-error
4249
classify();
43-
classify('blue man group'); // $ExpectType string
4450
// @ts-expect-error
4551
classify('', '');
4652

53+
expectTypeOf(classify('blue man group')).toBeString();
54+
4755
// @ts-expect-error
4856
capitalize();
49-
capitalize('blue man group'); // $ExpectType string
5057
// @ts-expect-error
5158
capitalize('', '');
59+
60+
expectTypeOf(capitalize('blue man group')).toBeString();

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6365,6 +6365,11 @@ expand-tilde@^2.0.0, expand-tilde@^2.0.2:
63656365
dependencies:
63666366
homedir-polyfill "^1.0.1"
63676367

6368+
expect-type@^0.15.0:
6369+
version "0.15.0"
6370+
resolved "https://registry.yarnpkg.com/expect-type/-/expect-type-0.15.0.tgz#89f75e22c88554844ea2b2faf4ef5fc2e579d3b5"
6371+
integrity sha512-yWnriYB4e8G54M5/fAFj7rCIBiKs1HAACaY13kCz6Ku0dezjS9aMcfcdVK2X8Tv2tEV1BPz/wKfQ7WA4S/d8aA==
6372+
63686373
express@^4.10.7, express@^4.17.1:
63696374
version "4.18.2"
63706375
resolved "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59"

0 commit comments

Comments
 (0)