Skip to content

Commit 595094f

Browse files
authored
Merge pull request #83 from agneym/82-upgrade-typescript
82-upgrade-typescript
2 parents a74287c + cbfced8 commit 595094f

26 files changed

+1825
-3268
lines changed

.changeset/solid-lands-crash.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@agney/playground": major
3+
---
4+
5+
- Update TypeScript to tsgo and fix type errors
6+
- Migrate from Microbundle to Tsdown
7+
- Migrate from Jest to Vitest

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["typescriptteam.native-preview"]
3+
}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"typescript.tsdk": "node_modules/typescript/lib"
2+
"typescript.experimental.useTsgo": true
33
}

lefthook.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ pre-commit:
22
parallel: true
33
jobs:
44
- run: pnpm format {staged_files}
5-
glob: "*"

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
"version": "changeset version",
1616
"release": "pnpm build && changeset publish",
1717
"format": "oxfmt --no-error-on-unmatched-pattern",
18-
"format:check": "oxfmt --check"
18+
"format:check": "oxfmt --check",
19+
"type:check": "pnpm --filter @agney/playground type:check"
1920
},
2021
"devDependencies": {
2122
"@changesets/changelog-github": "^0.5.2",
2223
"@changesets/cli": "^2.29.8",
24+
"@typescript/native-preview": "7.0.0-dev.20251219.1",
2325
"lefthook": "^2.0.12",
2426
"oxfmt": "^0.19.0",
2527
"typescript": "^4.4.4"

playground/.babelrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

playground/package.json

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@
3939
"access": "public"
4040
},
4141
"scripts": {
42-
"start": "microbundle watch --jsx React.createElement",
43-
"build": "microbundle --jsx React.createElement",
44-
"test": "jest",
45-
"prepublishOnly": "pnpm build"
42+
"start": "tsdown --watch",
43+
"build": "tsdown",
44+
"test": "vitest run",
45+
"test:watch": "vitest",
46+
"prepublishOnly": "pnpm build",
47+
"type:check": "tsgo --noEmit"
4648
},
4749
"dependencies": {
4850
"@agney/react-inspector": "^4.0.0",
@@ -54,30 +56,23 @@
5456
"react-simple-code-editor": "^0.11.0"
5557
},
5658
"devDependencies": {
57-
"@babel/core": "^7.15.8",
58-
"@babel/preset-env": "^7.15.8",
59-
"@babel/preset-react": "^7.14.5",
60-
"@babel/preset-typescript": "^7.15.0",
61-
"@testing-library/jest-dom": "^5.14.1",
59+
"@rollup/plugin-babel": "^6.1.0",
6260
"@testing-library/react": "^12.1.2",
63-
"@types/jest": "^27.0.2",
6461
"@types/lodash": "^4.14.175",
6562
"@types/lodash-es": "^4.17.5",
6663
"@types/lodash.merge": "^4.6.6",
6764
"@types/react": "^17.0.29",
6865
"@types/react-dom": "^17.0.9",
6966
"@types/react-inspector": "^4.0.2",
70-
"jest": "^27.2.5",
71-
"microbundle": "^0.14.0",
67+
"babel-plugin-react-compiler": "^1.0.0",
68+
"jsdom": "^26.0.0",
7269
"react": "^17.0.2",
73-
"react-dom": "^17.0.2"
70+
"react-dom": "^17.0.2",
71+
"tsdown": "^0.18.1",
72+
"vitest": "^3.0.0"
7473
},
7574
"peerDependencies": {
7675
"react": ">=16",
7776
"react-dom": ">=16"
78-
},
79-
"jest": {
80-
"rootDir": "src",
81-
"testEnvironment": "jsdom"
8277
}
8378
}

playground/scripts/test-utils.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
import React, { createElement, FC, ReactElement } from "react";
2-
import { render, RenderOptions } from "@testing-library/react";
1+
import { createElement } from "react";
2+
import type { FC, ReactElement, ReactNode } from "react";
3+
import * as testingLibrary from "@testing-library/react";
4+
import type { RenderOptions } from "@testing-library/react";
35
import { setup } from "goober";
46

57
import { ThemeProvider, useTheme } from "../src/utils/ThemeProvider";
68
import getTheme from "../src/utils/theme";
79

810
setup(createElement, undefined, useTheme);
911

10-
const AllProviders: FC = ({ children }) => {
12+
const AllProviders: FC<{ children: ReactNode }> = ({ children }) => {
1113
return (
1214
<ThemeProvider mode="light" userTheme={getTheme()}>
1315
{children}
1416
</ThemeProvider>
1517
);
1618
};
1719

18-
const customRender = (ui: ReactElement, options?: Omit<RenderOptions, "queries">) =>
19-
render(ui, { wrapper: AllProviders, ...options });
20+
function customRender(ui: ReactElement, options?: Omit<RenderOptions, "queries">) {
21+
return testingLibrary.render(ui, { wrapper: AllProviders, ...options });
22+
}
2023

2124
export * from "@testing-library/react";
2225

playground/src/Draggable/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { FC, ReactNode, useRef, forwardRef } from "react";
1+
import { useRef, forwardRef } from "react";
2+
import type { FC, ReactNode } from "react";
23
import { styled } from "goober";
34

45
import useDrag from "./useDrag";

playground/src/Draggable/useDrag.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { useState, useEffect, useCallback, RefObject } from "react";
1+
import { useState, useEffect, useCallback } from "react";
2+
import type { RefObject } from "react";
23

34
interface IProps {
45
containerRef: RefObject<HTMLDivElement | null>;

0 commit comments

Comments
 (0)