schemastore-to-typescript 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +92 -1
- package/CHANGELOG.md +23 -2
- package/dist/cli.js +3 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +31 -25
- package/dist/index.js.map +1 -1
- package/dist/url.d.ts +2 -0
- package/dist/url.js +4 -0
- package/dist/url.js.map +1 -0
- package/package.json +9 -9
- package/readme.md +14 -0
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,98 @@
|
|
|
2
2
|
"name": "schemastore-to-typescript",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Mon, 09 Nov 2026 14:18:17 GMT",
|
|
6
|
+
"version": "1.4.0",
|
|
7
|
+
"tag": "schemastore-to-typescript_v1.4.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"none": [
|
|
10
|
+
{
|
|
11
|
+
"author": "filip.dupanovic@gmail.com",
|
|
12
|
+
"package": "schemastore-to-typescript",
|
|
13
|
+
"commit": "299736e72267bac65189693fb68ed6b734030060",
|
|
14
|
+
"comment": "Upgrade @langri-sha/projen-project to 0.51.0"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "filip.dupanovic@gmail.com",
|
|
18
|
+
"package": "schemastore-to-typescript",
|
|
19
|
+
"commit": "299736e72267bac65189693fb68ed6b734030060",
|
|
20
|
+
"comment": "Upgrade to TypeScript 6"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"minor": [
|
|
24
|
+
{
|
|
25
|
+
"author": "filip.dupanovic@gmail.com",
|
|
26
|
+
"package": "schemastore-to-typescript",
|
|
27
|
+
"commit": "299736e72267bac65189693fb68ed6b734030060",
|
|
28
|
+
"comment": "Compile a schema from its https URL, as well as from its catalog name"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"patch": [
|
|
32
|
+
{
|
|
33
|
+
"author": "email not defined",
|
|
34
|
+
"package": "schemastore-to-typescript",
|
|
35
|
+
"commit": "299736e72267bac65189693fb68ed6b734030060",
|
|
36
|
+
"comment": "Update dependency @langri-sha/projen-project to v0.49.0"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"author": "email not defined",
|
|
40
|
+
"package": "schemastore-to-typescript",
|
|
41
|
+
"commit": "299736e72267bac65189693fb68ed6b734030060",
|
|
42
|
+
"comment": "Update dependency @langri-sha/tsconfig to v3"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"author": "email not defined",
|
|
46
|
+
"package": "schemastore-to-typescript",
|
|
47
|
+
"commit": "299736e72267bac65189693fb68ed6b734030060",
|
|
48
|
+
"comment": "Update dependency @langri-sha/projen-project to v0.49.2"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"author": "email not defined",
|
|
52
|
+
"package": "schemastore-to-typescript",
|
|
53
|
+
"commit": "299736e72267bac65189693fb68ed6b734030060",
|
|
54
|
+
"comment": "Update dependency @langri-sha/tsconfig to v2"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"author": "email not defined",
|
|
58
|
+
"package": "schemastore-to-typescript",
|
|
59
|
+
"commit": "299736e72267bac65189693fb68ed6b734030060",
|
|
60
|
+
"comment": "Update dependency @langri-sha/projen-project to v0.48.2"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"author": "email not defined",
|
|
64
|
+
"package": "schemastore-to-typescript",
|
|
65
|
+
"commit": "299736e72267bac65189693fb68ed6b734030060",
|
|
66
|
+
"comment": "Update dependency pnpm to v12.18.0"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"author": "email not defined",
|
|
70
|
+
"package": "schemastore-to-typescript",
|
|
71
|
+
"commit": "299736e72267bac65189693fb68ed6b734030060",
|
|
72
|
+
"comment": "Update dependency got to v16.2.0"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"author": "email not defined",
|
|
76
|
+
"package": "schemastore-to-typescript",
|
|
77
|
+
"commit": "299736e72267bac65189693fb68ed6b734030060",
|
|
78
|
+
"comment": "Update dependency @langri-sha/projen-project to v0.48.3"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"author": "email not defined",
|
|
82
|
+
"package": "schemastore-to-typescript",
|
|
83
|
+
"commit": "299736e72267bac65189693fb68ed6b734030060",
|
|
84
|
+
"comment": "Update dependency pnpm to v12.17.0"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"author": "email not defined",
|
|
88
|
+
"package": "schemastore-to-typescript",
|
|
89
|
+
"commit": "299736e72267bac65189693fb68ed6b734030060",
|
|
90
|
+
"comment": "Update dependency @langri-sha/projen-project to v0.52.0"
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"date": "Sun, 01 Nov 2026 16:59:00 GMT",
|
|
6
97
|
"version": "1.3.0",
|
|
7
98
|
"tag": "schemastore-to-typescript_v1.3.0",
|
|
8
99
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
# Change Log - schemastore-to-typescript
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Mon, 09 Nov 2026 14:18:17 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.4.0
|
|
8
|
+
|
|
9
|
+
Mon, 09 Nov 2026 14:18:17 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Compile a schema from its https URL, as well as from its catalog name (filip.dupanovic@gmail.com)
|
|
14
|
+
|
|
15
|
+
### Patches
|
|
16
|
+
|
|
17
|
+
- Update dependency @langri-sha/projen-project to v0.49.0
|
|
18
|
+
- Update dependency @langri-sha/tsconfig to v3
|
|
19
|
+
- Update dependency @langri-sha/projen-project to v0.49.2
|
|
20
|
+
- Update dependency @langri-sha/tsconfig to v2
|
|
21
|
+
- Update dependency @langri-sha/projen-project to v0.48.2
|
|
22
|
+
- Update dependency pnpm to v12.18.0
|
|
23
|
+
- Update dependency got to v16.2.0
|
|
24
|
+
- Update dependency @langri-sha/projen-project to v0.48.3
|
|
25
|
+
- Update dependency pnpm to v12.17.0
|
|
26
|
+
- Update dependency @langri-sha/projen-project to v0.52.0
|
|
27
|
+
|
|
7
28
|
## 1.3.0
|
|
8
29
|
|
|
9
|
-
Sun, 01 Nov 2026 16:
|
|
30
|
+
Sun, 01 Nov 2026 16:59:00 GMT
|
|
10
31
|
|
|
11
32
|
### Minor changes
|
|
12
33
|
|
package/dist/cli.js
CHANGED
|
@@ -4,12 +4,13 @@ import * as path from 'node:path';
|
|
|
4
4
|
import { Command, Option } from 'commander';
|
|
5
5
|
import createDebug from 'debug';
|
|
6
6
|
import esMain from 'es-main';
|
|
7
|
+
import { isSchemaUrl, urlName } from './url.js';
|
|
7
8
|
import { compile } from './index.js';
|
|
8
9
|
const debug = createDebug('schema-store-to-typescript');
|
|
9
10
|
export const program = new Command()
|
|
10
11
|
.name('schemastore-to-typescript')
|
|
11
12
|
.description('Compile a JSON schema store schema to TypeScript definitions')
|
|
12
|
-
.argument('<schema>', 'JSON schema store schema')
|
|
13
|
+
.argument('<schema>', 'JSON schema store schema name, or the https URL of a JSON schema')
|
|
13
14
|
.argument('[output]', 'Path to output the TypeScript definition')
|
|
14
15
|
.option('-n, --no-cache', 'Skip caching requests')
|
|
15
16
|
.option('--jsii', 'Emit typings that jsii can compile')
|
|
@@ -17,7 +18,7 @@ export const program = new Command()
|
|
|
17
18
|
.option('--type-name <name>', 'Name the root interface')
|
|
18
19
|
.showHelpAfterError()
|
|
19
20
|
.action(async (schema, output, { cache, jsii, keepNull, typeName }) => {
|
|
20
|
-
output ??= `${schema}.d.ts`;
|
|
21
|
+
output ??= `${isSchemaUrl(schema) ? urlName(schema) : schema}.d.ts`;
|
|
21
22
|
const compiled = await compile(schema, cache, {
|
|
22
23
|
jsii,
|
|
23
24
|
keepNull,
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,WAAW,MAAM,OAAO,CAAA;AAC/B,OAAO,MAAM,MAAM,SAAS,CAAA;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,MAAM,KAAK,GAAG,WAAW,CAAC,4BAA4B,CAAC,CAAA;AAEvD,MAAM,CAAC,MAAM,OAAO,GAAY,IAAI,OAAO,EAAE;KAC1C,IAAI,CAAC,2BAA2B,CAAC;KACjC,WAAW,CAAC,8DAA8D,CAAC;KAC3E,QAAQ,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,WAAW,MAAM,OAAO,CAAA;AAC/B,OAAO,MAAM,MAAM,SAAS,CAAA;AAE5B,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,MAAM,KAAK,GAAG,WAAW,CAAC,4BAA4B,CAAC,CAAA;AAEvD,MAAM,CAAC,MAAM,OAAO,GAAY,IAAI,OAAO,EAAE;KAC1C,IAAI,CAAC,2BAA2B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SACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;AACN,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,8 @@ export interface CompileOptions {
|
|
|
13
13
|
*/
|
|
14
14
|
keepNull?: boolean;
|
|
15
15
|
/**
|
|
16
|
-
* Name the root interface, instead of the catalog's name for the schema
|
|
16
|
+
* Name the root interface, instead of the catalog's name for the schema, or
|
|
17
|
+
* the name of the file of a schema given by its URL.
|
|
17
18
|
*/
|
|
18
19
|
typeName?: string;
|
|
19
20
|
}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import Keyv from 'keyv';
|
|
|
7
7
|
import { KeyvFile } from 'keyv-file';
|
|
8
8
|
import { compilerOptions as jsiiCompilerOptions, jsiiSchema, jsiiTypings, } from './jsii.js';
|
|
9
9
|
import { normalizeSchema } from './normalize.js';
|
|
10
|
+
import { isSchemaUrl, urlName } from './url.js';
|
|
10
11
|
const debug = createDebug('schema-store-to-typescript');
|
|
11
12
|
const paths = envPaths('schemastore-to-typescript');
|
|
12
13
|
const store = new KeyvFile({
|
|
@@ -146,54 +147,59 @@ export const compile = async (name, cache = true, { jsii = false, keepNull = fal
|
|
|
146
147
|
throw e;
|
|
147
148
|
}
|
|
148
149
|
};
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
let catalogSchema;
|
|
151
|
+
if (!isSchemaUrl(name)) {
|
|
152
|
+
try {
|
|
153
|
+
// First, fetch the catalog
|
|
154
|
+
catalog = await fetchWithRetry(catalogUrl);
|
|
155
|
+
}
|
|
156
|
+
catch (e) {
|
|
157
|
+
debug(e);
|
|
158
|
+
if (e instanceof HTTPError) {
|
|
159
|
+
throw new Error(`Couldn't retrieve catalog from ${catalogUrl}. [${e.code}]`, { cause: e });
|
|
160
|
+
}
|
|
161
|
+
throw e;
|
|
162
|
+
}
|
|
163
|
+
const schemaMap = new Map();
|
|
164
|
+
for (const schema of catalog.schemas) {
|
|
165
|
+
schemaMap.set(schema.name.toLowerCase(), schema);
|
|
166
|
+
}
|
|
167
|
+
catalogSchema = schemaMap.get(name.toLowerCase());
|
|
168
|
+
if (!catalogSchema) {
|
|
169
|
+
throw new Error(`Couldn't find schema ${name} in the catalog. Are you sure it exists?`);
|
|
157
170
|
}
|
|
158
|
-
throw e;
|
|
159
|
-
}
|
|
160
|
-
const schemaMap = new Map();
|
|
161
|
-
for (const schema of catalog.schemas) {
|
|
162
|
-
schemaMap.set(schema.name.toLowerCase(), schema);
|
|
163
|
-
}
|
|
164
|
-
const catalogSchema = schemaMap.get(name.toLowerCase());
|
|
165
|
-
if (!catalogSchema) {
|
|
166
|
-
throw new Error(`Couldn't find schema ${name} in the catalog. Are you sure it exists?`);
|
|
167
171
|
}
|
|
172
|
+
const schemaUrl = catalogSchema?.url ?? name;
|
|
168
173
|
try {
|
|
169
174
|
// Fetch the actual schema from the found URL
|
|
170
|
-
debug(`Fetching schema from: ${
|
|
171
|
-
schema = await fetchWithRetry(
|
|
175
|
+
debug(`Fetching schema from: ${schemaUrl}`);
|
|
176
|
+
schema = await fetchWithRetry(schemaUrl);
|
|
172
177
|
if (typeof schema === 'object' && schema !== null) {
|
|
173
|
-
schema.title = typeName ?? catalogSchema
|
|
178
|
+
schema.title = typeName ?? catalogSchema?.name ?? urlName(name);
|
|
174
179
|
}
|
|
175
180
|
}
|
|
176
181
|
catch (e) {
|
|
177
182
|
debug(e);
|
|
178
183
|
if (e instanceof HTTPError) {
|
|
179
184
|
if (e.response.statusCode === 404) {
|
|
180
|
-
throw new Error(`Couldn't find schema ${name} at ${
|
|
185
|
+
throw new Error(`Couldn't find schema ${name}${catalogSchema ? ` at ${schemaUrl}` : ''}. Are you sure it exists?`, { cause: e });
|
|
181
186
|
}
|
|
182
|
-
throw new Error(`Couldn't retrieve schema from ${
|
|
187
|
+
throw new Error(`Couldn't retrieve schema from ${schemaUrl}. [${e.code}] Status: ${e.response.statusCode}`, { cause: e });
|
|
183
188
|
}
|
|
184
189
|
if (e instanceof Error && e.message.includes('is not valid JSON')) {
|
|
185
|
-
throw new Error(`Failed to parse JSON from ${
|
|
190
|
+
throw new Error(`Failed to parse JSON from ${schemaUrl}. The server might be returning invalid or compressed content. Error: ${e.message}`, { cause: e });
|
|
186
191
|
}
|
|
187
192
|
throw e;
|
|
188
193
|
}
|
|
189
194
|
if (cache) {
|
|
190
195
|
await flushCache();
|
|
191
196
|
}
|
|
197
|
+
const schemaName = catalogSchema ? name : urlName(name);
|
|
192
198
|
const normalized = sanitizeSchema(normalizeSchema(schema));
|
|
193
199
|
if (!jsii && !keepNull) {
|
|
194
|
-
return compileSource(normalized,
|
|
200
|
+
return compileSource(normalized, schemaName);
|
|
195
201
|
}
|
|
196
|
-
return jsiiTypings(await compileSource(jsiiSchema(normalized, { keepNull }),
|
|
202
|
+
return jsiiTypings(await compileSource(jsiiSchema(normalized, { keepNull }), schemaName, keepNull
|
|
197
203
|
? { ...jsiiCompilerOptions, unknownAny: false }
|
|
198
204
|
: jsiiCompilerOptions));
|
|
199
205
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,WAAW,MAAM,OAAO,CAAA;AAC/B,OAAO,QAAQ,MAAM,WAAW,CAAA;AAChC,OAAO,GAAG,EAAE,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AACpC,OAAO,EAEL,OAAO,IAAI,aAAa,GACzB,MAAM,2BAA2B,CAAA;AAClC,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,QAAQ,EA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ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAc,EAAW,EAAE,CACrD,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAU,EAAE,CAC7C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "schemastore-to-typescript",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Fetch JSON schemas from the JSON Schema Store catalog and compile them to TypeScript typings",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -44,32 +44,32 @@
|
|
|
44
44
|
"debug": "4.4.3",
|
|
45
45
|
"env-paths": "4.0.0",
|
|
46
46
|
"es-main": "1.4.0",
|
|
47
|
-
"got": "16.
|
|
47
|
+
"got": "16.2.0",
|
|
48
48
|
"json-schema-to-typescript": "16.0.0",
|
|
49
49
|
"keyv": "5.6.0",
|
|
50
50
|
"keyv-file": "5.3.5"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@langri-sha/eslint-config": "0.
|
|
53
|
+
"@langri-sha/eslint-config": "0.13.0",
|
|
54
54
|
"@langri-sha/lint-staged": "0.9.11",
|
|
55
55
|
"@langri-sha/prettier": "0.4.11",
|
|
56
|
-
"@langri-sha/projen-project": "0.
|
|
57
|
-
"@langri-sha/tsconfig": "
|
|
56
|
+
"@langri-sha/projen-project": "0.52.0",
|
|
57
|
+
"@langri-sha/tsconfig": "3.0.0",
|
|
58
58
|
"@langri-sha/vitest": "0.2.3",
|
|
59
59
|
"@types/debug": "4.1.13",
|
|
60
60
|
"@types/node": "24.19.2",
|
|
61
61
|
"beachball": "2.66.0",
|
|
62
|
-
"eslint": "10.
|
|
62
|
+
"eslint": "10.14.0",
|
|
63
63
|
"husky": "9.1.7",
|
|
64
64
|
"lint-staged": "17.6.0",
|
|
65
65
|
"prettier": "3.9.9",
|
|
66
66
|
"projen": "0.104.1",
|
|
67
|
-
"skills": "1.7.
|
|
67
|
+
"skills": "1.7.6",
|
|
68
68
|
"tsx": "4.23.15",
|
|
69
|
-
"typescript": "
|
|
69
|
+
"typescript": "6.0.3",
|
|
70
70
|
"vitest": "5.0.5"
|
|
71
71
|
},
|
|
72
|
-
"packageManager": "pnpm@12.
|
|
72
|
+
"packageManager": "pnpm@12.18.0",
|
|
73
73
|
"devEngines": {
|
|
74
74
|
"runtime": {
|
|
75
75
|
"name": "node",
|
package/readme.md
CHANGED
|
@@ -26,6 +26,18 @@ schemastore-to-typescript 'cargo manifest' src/cargo.ts
|
|
|
26
26
|
|
|
27
27
|
Downloads are cached; pass `--no-cache` to skip the cache.
|
|
28
28
|
|
|
29
|
+
An `https` URL takes the place of the name, to compile a schema at a fixed
|
|
30
|
+
location, such as a file of a tagged release, without the catalog. The options
|
|
31
|
+
apply as they do to a name, and the output defaults to `<file>.d.ts`. Without
|
|
32
|
+
`--type-name`, the root interface takes the name of its file, so pass
|
|
33
|
+
`--type-name` for a URL that pins a version. Only the schema itself goes through
|
|
34
|
+
the cache. A `$ref` to another document is left to the compiler: an absolute URL
|
|
35
|
+
is fetched live and a relative path is read from the working directory.
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
schemastore-to-typescript https://unpkg.com/renovate@44.168.4/renovate-schema.json src/renovate.ts
|
|
39
|
+
```
|
|
40
|
+
|
|
29
41
|
The same is available as a function, which resolves to the generated module and
|
|
30
42
|
takes `false` as its second argument to skip the cache:
|
|
31
43
|
|
|
@@ -35,6 +47,8 @@ import { compile } from 'schemastore-to-typescript'
|
|
|
35
47
|
const typings = await compile('swcrc')
|
|
36
48
|
```
|
|
37
49
|
|
|
50
|
+
It takes a URL where the name goes, as the command does.
|
|
51
|
+
|
|
38
52
|
## Usage with jsii
|
|
39
53
|
|
|
40
54
|
Typings exported from the API of a [jsii] package have to fit what jsii can
|