@josepot/typed-json
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

typed-json

JSON.stringify and JSON.parse with better support for TS.

import { stringify, parse } from '@josepot/typed-json';


interface Data {
  foo: string;
  bar: number;
}

const data: Data = { foo: 'foo', bar: 10 };

const dataStr = stringify(data); // const dataStr: JsonString<Data>
const dataClone = parse(dataStr); // const dataClone: Data

Readme

Keywords

none

Package Sidebar

Install

npm i @josepot/typed-json

Weekly Downloads

3

Version

0.1.1

License

MIT

Unpacked Size

5.7 kB

Total Files

12

Last publish

Collaborators

  • josepot