Skip to content

Commit 60c3a68

Browse files
committed
TypeScript: limit type to known registries
1 parent 804dbb1 commit 60c3a68

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

index.d.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,18 @@ export class MediaType {
99
constructor(mediaType?: string);
1010

1111
essence: string;
12-
type: string;
12+
type:
13+
| "application"
14+
| "audio"
15+
| "font"
16+
| "image"
17+
| "haptics"
18+
| "message"
19+
| "model"
20+
| "multipart"
21+
| "text"
22+
| "video"
23+
| "*";
1324
subtype: string;
1425
subtypeFacets: string[];
1526
suffix: string | null;

test/index.test-d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import { MediaType } from "..";
99

10-
const input: string = "a/b+c";
10+
const input: string = "application/test+json; charset=utf-8";
1111

1212
const mediaTypeConstructed: MediaType = new MediaType(input);
1313

0 commit comments

Comments
 (0)