File tree Expand file tree Collapse file tree 3 files changed +24028
-1091
lines changed Expand file tree Collapse file tree 3 files changed +24028
-1091
lines changed Original file line number Diff line number Diff line change 1
1
import { InputConfig } from "./types" ;
2
2
3
+ type Whitespace = " " | "\t" | "\n" | "\r" ;
4
+
3
5
type With$fn < T > = {
4
6
[ K in keyof T ] :
5
7
| ( T [ K ] extends ( infer U ) [ ]
6
8
? With$fn < U > [ ] // handle arrays recursively
7
9
: T [ K ] extends object
8
- ? With$fn < T [ K ] > // handle objects recursively
9
- : T [ K ] ) // retain original type
10
- | ( string & `$ex ${string } `)
11
- | ( string & `$fn ${ string } `) ; // allow string starting with $ex or $fn
10
+ ? With$fn < T [ K ] > // handle objects recursively
11
+ : T [ K ] ) // retain original type
12
+ | ( string & `${ Whitespace | "" } $ex${ Whitespace } ${string } `)
13
+ | ( string & `${ Whitespace | "" } $fn${ Whitespace } ${ string } `) ; // allow string starting with $ex or $fn with optional whitespace
12
14
} ;
13
15
14
- export type JsonSchemaRoot = With$fn < InputConfig >
16
+ export type JsonSchemaRoot = With$fn < InputConfig > ;
Original file line number Diff line number Diff line change 6
6
"scripts" : {
7
7
"start" : " npm run schema && webpack serve --open --mode development" ,
8
8
"build" : " npm run schema &&rm -rf dist && webpack --mode production" ,
9
- "schema" : " cd .. && typescript-json-schema --noExtraProps tsconfig.json InputConfig > yaml-editor/src/schema.json" ,
9
+ "schema" : " cd .. && typescript-json-schema --required tsconfig.json JsonSchemaRoot > yaml-editor/src/schema.json" ,
10
10
"deploy" : " pnpm run build && gh-pages -d dist"
11
11
},
12
12
"dependencies" : {
You can’t perform that action at this time.
0 commit comments