Skip to content

Commit 6f7f695

Browse files
committed
Add types
1 parent ee70fc6 commit 6f7f695

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
*.d.ts
12
*.log
3+
*.map
4+
*.tsbuildinfo
25
.DS_Store
36
dest/
47
node_modules/

package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"bugs": "https://github.com/remarkjs/react-markdown/issues",
55
"contributors": [],
66
"devDependencies": {
7+
"@types/react": "^18.0.0",
8+
"@types/react-dom": "^18.0.0",
79
"@wooorm/starry-night": "^3.0.0",
810
"cssnano": "^7.0.0",
911
"esbuild": "^0.24.0",
@@ -26,6 +28,8 @@
2628
"remark-toc": "^9.0.0",
2729
"stylelint": "^16.0.0",
2830
"stylelint-config-standard": "^36.0.0",
31+
"type-coverage": "^2.0.0",
32+
"typescript": "^5.0.0",
2933
"xo": "^0.59.0"
3034
},
3135
"license": "MIT",
@@ -48,14 +52,15 @@
4852
"private": true,
4953
"repository": "remarkjs/react-markdown",
5054
"scripts": {
55+
"build": "tsc --build --clean && tsc --build && type-coverage",
5156
"generate:css": "postcss --output dest/index.css -- src/index.css",
5257
"generate:html": "rehype --output dest/ --quiet --use rehype-preset-minify --use rehype-prevent-favicon-request -- src/",
5358
"generate:js:module": "esbuild src/index.js --bundle --conditions=browser,production --define:process.env.NODE_ENV=\\\"production\\\" --format=esm --loader:.js=jsx --log-level=warning --minify --outfile=dest/index.module.js --target=es2020",
5459
"generate:js:nomodule": "esbuild src/index.js --bundle --conditions=browser,production --define:process.env.NODE_ENV=\\\"production\\\" --loader:.js=jsx --log-level=warning --minify --outfile=dest/index.nomodule.js --target=es6",
5560
"generate:js": "npm run generate:js:module && npm run generate:js:nomodule",
5661
"generate": "npm run generate:css && npm run generate:html && npm run generate:js",
5762
"format": "prettier --log-level warn --write -- . && stylelint --fix src/index.css && xo --fix",
58-
"test": "npm run format && npm run build"
63+
"test": "npm run build && npm run format && npm run generate"
5964
},
6065
"stylelint": {
6166
"extends": "stylelint-config-standard"

tsconfig.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"compilerOptions": {
3+
"checkJs": true,
4+
"customConditions": ["development"],
5+
"declarationMap": true,
6+
"declaration": true,
7+
"emitDeclarationOnly": true,
8+
"exactOptionalPropertyTypes": true,
9+
"jsx": "preserve",
10+
"lib": ["dom", "es2023"],
11+
"module": "node16",
12+
"strict": true,
13+
"target": "es2023"
14+
},
15+
"exclude": ["dest/", "node_modules/"],
16+
"include": ["**/*.js", "**/*.jsx"]
17+
}

0 commit comments

Comments
 (0)