1.4.2 • Published 10 months ago

@5cover/ts-json-as-const v1.4.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

ts-json-as-const

License: MIT

Server checks

Installation

Install with pnpm

pnpm add @5cover/ts-json-as-const

Install with yarn

yarn add @5cover/ts-json-as-const

Install with npm

npm install --save @5cover/ts-json-as-const

Usage

npx ts-json-as-const [path/to/json/file.json ...]
pnpm dlx ts-json-as-const [path/to/json/file.json ...]

Examples

Input example.json

{
	"compilerOptions": {
		"target": "es2016",
		"module": "commonjs",
		"strict": true,
		"esModuleInterop": true,
		"skipLibCheck": true,
		"forceConsistentCasingInFileNames": true
	}
}

Output example.json.d.ts

export type Tsconfig = {
	compilerOptions: {
		target: 'es2016';
		module: 'commonjs';
		strict: true;
		esModuleInterop: true;
		skipLibCheck: true;
		forceConsistentCasingInFileNames: true;
	};
};
declare const Tsconfig: Tsconfig;
export = Tsconfig;

Input array.json

[
	{
		"name": "John",
		"age": 30,
		"cars": [
			{
				"name": "Ford",
				"models": [{ "name": "Fiesta" }, { "name": "Focus" }]
			},
			{
				"name": "BMW",
				"models": [{ "name": "320" }, { "name": "X3" }]
			},
			{
				"name": "Fiat",
				"models": [{ "name": "500" }, { "name": "Panda" }]
			}
		]
	}
]

Output array.json.d.ts

export type Array = [
	{
		name: 'John';
		age: 30;
		cars: [
			{ name: 'Ford'; models: [{ name: 'Fiesta' }, { name: 'Focus' }] },
			{ name: 'BMW'; models: [{ name: '320' }, { name: 'X3' }] },
			{ name: 'Fiat'; models: [{ name: '500' }, { name: 'Panda' }] },
		];
	},
];
declare const Array: Array;
export = Array;

Authors

šŸ‘¤ Gabriel Roberge

šŸ‘¤ Bethany Hitch (Original Author)

1.4.2

10 months ago

1.4.1

10 months ago

1.4.0

10 months ago

1.3.2

10 months ago

1.3.1

10 months ago

1.3.0

10 months ago

1.2.1

10 months ago

1.2.0

10 months ago

1.1.2

10 months ago

1.1.1

10 months ago