From 15dc48b363477bf7544ca312b5c758a5874f4303 Mon Sep 17 00:00:00 2001 From: Ryan Huellen Date: Tue, 5 Nov 2024 18:09:47 -0600 Subject: [PATCH] feat: `tsconfig.json` polyfill configuration (#7) --- README.md | 9 +++++++++ package.json | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e9108d3..5369f64 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file diff --git a/package.json b/package.json index a8830c8..d244000 100644 --- a/package.json +++ b/package.json @@ -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",