Skip to content

Commit

Permalink
Remove TypeScript as an explicit peer dependency.
Browse files Browse the repository at this point in the history
This is one potential fix to google#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 google#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.
  • Loading branch information
Eyas committed May 16, 2022
1 parent d2bb057 commit 5a826f4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<Person> = {
'@context': 'https://schema.org',
Expand Down Expand Up @@ -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',
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
"npm": ">=7.0.0"
},
"engineStrict": true,
"peerDependencies": {
"typescript": ">=4.5.5"
},
"nyc": {
"extension": [
".ts",
Expand Down
6 changes: 3 additions & 3 deletions packages/schema-dts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -54,7 +54,7 @@ to describe the URIs represeting the types and properties being referenced.
schema-dts provides the `WithContext<T>` type to facilitate this.

```ts
import {Organization, Thing, WithContext} from 'schema-dts';
import type {Organization, Thing, WithContext} from 'schema-dts';

export function JsonLd<T extends Thing>(json: WithContext<T>): string {
return `<script type="application/ld+json">
Expand Down Expand Up @@ -87,7 +87,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',
Expand Down
5 changes: 1 addition & 4 deletions packages/schema-dts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "schema-dts",
"version": "1.1.0",
"version": "1.1.1",
"displayName": "schema-dts: Strongly-typed Schema.org vocabulary declarations",
"description": "A TypeScript package with latest Schema.org Schema Typings",
"author": "Eyas Sharaiha <[email protected]> (https://eyas.sh/)",
Expand All @@ -22,9 +22,6 @@
"mkdirp": "^1.0.4",
"schema-dts-gen": "*"
},
"peerDependencies": {
"typescript": ">=4.1.0"
},
"keywords": [
"typescript",
"tsd",
Expand Down

0 comments on commit 5a826f4

Please sign in to comment.