From 5a826f4150794f96d8cccb910a7137c764f811ca Mon Sep 17 00:00:00 2001 From: Eyas Sharaiha Date: Mon, 16 May 2022 16:51:13 -0400 Subject: [PATCH] Remove TypeScript as an explicit peer dependency. This is one potential fix to #180 that allows schema-dts to continue to be used with `import` and any/no bundlers without increasing bundle size. It is also possible to address #180 by simply asking users to save schema-dts as a dev dependency. This is generally more correct for typings, but runs the risk of leaving dangling imports to nonexistent "schema-dts" js. We _may_ want to add TypeScript as a dev dependency instead. I'm not sure. --- README.md | 4 ++-- package.json | 3 --- packages/schema-dts/README.md | 6 +++--- packages/schema-dts/package.json | 5 +---- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f978c9b..4f0d67d 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ You will usually want your top-level item to include a `@context`, like can augment it with `WithContext`, e.g.: ```ts -import {Person, WithContext} from 'schema-dts'; +import type {Person, WithContext} from 'schema-dts'; const p: WithContext = { '@context': 'https://schema.org', @@ -75,7 +75,7 @@ their parent. Other objects are defined at the top-level with an `@id`, because multiple nodes refer to them. ```ts -import {Graph} from 'schema-dts'; +import type {Graph} from 'schema-dts'; const graph: Graph = { '@context': 'https://schema.org', diff --git a/package.json b/package.json index a34a6fa..68a0f24 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,6 @@ "npm": ">=7.0.0" }, "engineStrict": true, - "peerDependencies": { - "typescript": ">=4.5.5" - }, "nyc": { "extension": [ ".ts", diff --git a/packages/schema-dts/README.md b/packages/schema-dts/README.md index a712b7a..bf16565 100644 --- a/packages/schema-dts/README.md +++ b/packages/schema-dts/README.md @@ -31,7 +31,7 @@ Then you can use it by importing `"schema-dts"`. ### Defining Simple Properties ```ts -import {Person} from 'schema-dts'; +import type {Person} from 'schema-dts'; const inventor: Person = { '@type': 'Person', @@ -54,7 +54,7 @@ to describe the URIs represeting the types and properties being referenced. schema-dts provides the `WithContext` type to facilitate this. ```ts -import {Organization, Thing, WithContext} from 'schema-dts'; +import type {Organization, Thing, WithContext} from 'schema-dts'; export function JsonLd(json: WithContext): string { return `