Skip to content

Commit 4781576

Browse files
committed
Add a new Typescript config
1 parent b585ecd commit 4781576

64 files changed

Lines changed: 537 additions & 10 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@
2020
"private": false,
2121
"files": [
2222
"index.js",
23+
"typescript.js",
2324
"README.md",
2425
"LICENSE"
2526
],
2627
"main": "index.js",
28+
"exports": {
29+
".": "./index.js",
30+
"./typescript": "./typescript.js"
31+
},
2732
"scripts": {
2833
"test": "vitest"
2934
},
@@ -33,6 +38,7 @@
3338
"@babel/preset-env": "^7.28.3",
3439
"@babel/preset-flow": "^7.27.1",
3540
"@babel/preset-react": "^7.27.1",
41+
"@babel/preset-typescript": "^7.27.1",
3642
"babel-plugin-syntax-hermes-parser": "^0.32.0"
3743
},
3844
"devDependencies": {

test/fixtures/flow.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,14 @@ export default [
77
let a: A = 'hello'
88
`,
99
],
10+
[
11+
'Regression: Flow void class properties',
12+
`
13+
// @flow
14+
type Props = {}
15+
class C {
16+
props: Props
17+
}
18+
`,
19+
],
1020
];

test/fixtures/regressions.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
export default [
2-
[
3-
'Regression: Flow void class properties',
4-
`
5-
// @flow
6-
type Props = {}
7-
class C {
8-
props: Props
9-
}
10-
`,
11-
],
122
[
133
'Regression: Webpack magic comments',
144
`

test/fixtures/typescript.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export default [
2+
[
3+
'Typescript: Types',
4+
`
5+
type A = string
6+
let a: A = 'hello'
7+
`,
8+
],
9+
];
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"use strict";
2+
3+
[1, 2].flatMap(x => [x * 2]);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"use strict";
2+
3+
Object.entries({
4+
a: 1
5+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"use strict";
2+
3+
Promise.allSettled([Promise.resolve(1), Promise.resolve(2)]).then(rs => rs.forEach(r => console.log(r.status)));
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"use strict";
2+
3+
new Map();
4+
new Set();
5+
new Promise();
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"use strict";
2+
3+
(async function () {
4+
await foo();
5+
})();

0 commit comments

Comments
 (0)