https://github.com/streamich/ts-brand-json
TypeScript type for JSON-in-a-string
https://github.com/streamich/ts-brand-json
Last synced: 11 months ago
JSON representation
TypeScript type for JSON-in-a-string
- Host: GitHub
- URL: https://github.com/streamich/ts-brand-json
- Owner: streamich
- Created: 2018-10-17T11:05:34.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T11:34:55.000Z (over 2 years ago)
- Last Synced: 2024-05-01T12:32:53.175Z (about 2 years ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ts-brand-json
TypeScript type for JSON strings.
```ts
import {JSON, json} from 'ts-brand-json';
const str = '{"hello": "world"}' as json<{hello: string}>;
JSON.parse(str).hello; // OK
JSON.parse(str).foo; // Error: ...
```