Skip to content

Commit 4805654

Browse files
committed
1 parent f10cf74 commit 4805654

5 files changed

Lines changed: 78 additions & 5 deletions

File tree

index.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export function camelize(str: string): string;
2+
export function capitalize(str: string): string;
3+
export function classify(str: string): string;
4+
export function dasherize(str: string): string;
5+
export function decamelize(str: string): string;
6+
export function underscore(str: string): string;
7+
export function w(str: string): string[];

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"start": "ember serve",
2626
"test": "npm-run-all lint test:*",
2727
"test:ember": "ember test",
28+
"test:types": "tsc --noEmit --project ./type-tests/tsconfig.json",
2829
"test:ember-compatibility": "ember try:each",
2930
"test-typings": "node node_modules/typescript/bin/tsc",
3031
"prepack": "yarn babel --extensions '.ts' --presets @babel/preset-typescript addon --out-dir addon/ --ignore '**/*.d.ts'",
@@ -42,6 +43,7 @@
4243
"@embroider/test-setup": "^0.47.1",
4344
"@glimmer/component": "^1.0.4",
4445
"@glimmer/tracking": "^1.0.4",
46+
"@tsconfig/ember": "^2.0.0",
4547
"@types/ember": "^3.16.5",
4648
"@types/ember-qunit": "^3.4.14",
4749
"@types/ember__test-helpers": "^2.0.2",
@@ -84,7 +86,7 @@
8486
"release-it": "^14.11.6",
8587
"release-it-lerna-changelog": "^3.1.0",
8688
"rimraf": "^3.0.2",
87-
"typescript": "^4.4.4",
89+
"typescript": "^5.0.4",
8890
"webpack": "^5"
8991
},
9092
"engines": {

type-tests/the-tests.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import {
2+
dasherize,
3+
camelize,
4+
capitalize,
5+
classify,
6+
decamelize,
7+
underscore,
8+
w,
9+
} from '@ember/string';
10+
11+
// @ts-expect-error
12+
dasherize();
13+
dasherize('blue man group'); // $ExpectType string
14+
// @ts-expect-error
15+
dasherize('', '');
16+
17+
// @ts-expect-error
18+
camelize();
19+
camelize('blue man group'); // $ExpectType string
20+
// @ts-expect-error
21+
camelize('', '');
22+
23+
// @ts-expect-error
24+
decamelize();
25+
decamelize('blue man group'); // $ExpectType string
26+
// @ts-expect-error
27+
decamelize('', '');
28+
29+
// @ts-expect-error
30+
underscore();
31+
underscore('blue man group'); // $ExpectType string
32+
// @ts-expect-error
33+
underscore('', '');
34+
35+
// @ts-expect-error
36+
w();
37+
w('blue man group'); // $ExpectType string[]
38+
// @ts-expect-error
39+
w('', '');
40+
41+
// @ts-expect-error
42+
classify();
43+
classify('blue man group'); // $ExpectType string
44+
// @ts-expect-error
45+
classify('', '');
46+
47+
// @ts-expect-error
48+
capitalize();
49+
capitalize('blue man group'); // $ExpectType string
50+
// @ts-expect-error
51+
capitalize('', '');

type-tests/tsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "@tsconfig/ember",
3+
"compilerOptions": {
4+
"paths": {
5+
"@ember/string": ["../"]
6+
}
7+
}
8+
}

yarn.lock

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,6 +1774,11 @@
17741774
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
17751775
integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==
17761776

1777+
"@tsconfig/ember@^2.0.0":
1778+
version "2.0.0"
1779+
resolved "https://registry.yarnpkg.com/@tsconfig/ember/-/ember-2.0.0.tgz#dba953e5527ccf7a2587f262a7afe0fa83c4e979"
1780+
integrity sha512-RzbDYYcjxVdG8Ki0xe99HN3+nHTZe6EBgw6N7B3yup7QogVFQQxA9nY7X80j1XzF15xqetwWiYfAjv5lkkp0/A==
1781+
17771782
"@types/body-parser@*":
17781783
version "1.19.1"
17791784
resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.1.tgz#0c0174c42a7d017b818303d4b5d969cb0b75929c"
@@ -12499,10 +12504,10 @@ typescript-memoize@^1.0.0-alpha.3:
1249912504
resolved "https://registry.yarnpkg.com/typescript-memoize/-/typescript-memoize-1.0.1.tgz#0a8199aa28f6fe18517f6e9308ef7bfbe9a98d59"
1250012505
integrity sha512-oJNge1qUrOK37d5Y6Ly2txKeuelYVsFtNF6U9kXIN7juudcQaHJQg2MxLOy0CqtkW65rVDYuTCOjnSIVPd8z3w==
1250112506

12502-
typescript@^4.4.4:
12503-
version "4.4.4"
12504-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c"
12505-
integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==
12507+
typescript@^5.0.4:
12508+
version "5.0.4"
12509+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b"
12510+
integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==
1250612511

1250712512
uc.micro@^1.0.1, uc.micro@^1.0.5:
1250812513
version "1.0.6"

0 commit comments

Comments
 (0)