Skip to content

Commit

Permalink
feat: tsconfig.json polyfill configuration (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhaticus authored Nov 6, 2024
1 parent 9259217 commit 15dc48b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ import '@tsmetadata/polyfill';

After doing so, `Symbol.metadata` will be defined.

You may also need to configure your `tsconfig.json` to target <= ES2022 and include the `esnext.decorators` library. The easiest way to do this is to extend our included polyfill-ready configuration.

```json
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": ["@tsmetadata/polyfill/tsconfig.json"],
}
```

## 🙏 Thanks

Special thanks to Oleksandr Tarasiuk for implementing decorator metadata and to Andrew Branch for releasing an early version of this polyfill.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
"publishConfig": {
"access": "public"
},
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"exports": {
".": "./lib/index.js",
"./tsconfig.json": "./lib/tsconfig.polyfill.json"
},
"scripts": {
"build": "npm run clean && tsc && cp ./src/*.json ./lib",
"clean": "rm -rf ./lib",
Expand Down

0 comments on commit 15dc48b

Please sign in to comment.