-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize modules, set build output
- Loading branch information
Showing
9 changed files
with
76 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,3 +59,5 @@ typings/ | |
|
||
# next.js build output | ||
.next | ||
|
||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as JSONSchemaTypeMapper from 'json-schema-type-mapper' | ||
import { OpenAPIObject } from '.' | ||
import { ValueOf } from './util' | ||
|
||
// Digging up schemas by hand since json-schema-type-mapper expects to find them | ||
// under `/definitions`, not in OpenAPI's `/components/schemas`: | ||
export type Schemas<S extends OpenAPIObject> = S['components']['schemas'] | ||
|
||
export type SchemaIds<S extends OpenAPIObject> = Exclude< | ||
ValueOf<Schemas<S>>['$id'], | ||
undefined | ||
> | ||
|
||
export type SchemasById<S extends OpenAPIObject> = { | ||
[Id in SchemaIds<S>]: ValueOf< | ||
{ | ||
[P in keyof Schemas<S>]: Schemas<S>[P]['$id'] extends Id | ||
? Schemas<S>[P] | ||
: never | ||
} | ||
> | ||
} | ||
|
||
export type JSONSchema< | ||
T, | ||
S extends OpenAPIObject | ||
> = JSONSchemaTypeMapper.Schema<T, SchemasById<S>> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Force TS to load a type that has not been computed | ||
* https://github.com/pirix-gh/ts-toolbelt | ||
*/ | ||
export type Compute<A extends any> = A extends Function // tslint:disable-line:ban-types | ||
? A | ||
: { [K in keyof A]: A[K] } & {} | ||
|
||
/** | ||
* Courtesy of @jcalz at https://stackoverflow.com/a/50375286/1763012 | ||
*/ | ||
export type UnionToIntersection<U> = (U extends any | ||
? (k: U) => void | ||
: never) extends (k: infer I) => void | ||
? I | ||
: never | ||
|
||
export type ValueOf<T extends object> = T[keyof T] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"declaration": true, | ||
"moduleResolution": "node", | ||
"noEmit": true, | ||
"strict": true | ||
} | ||
"outDir": "build", | ||
"strict": true, | ||
}, | ||
"include": [ | ||
"./src/**/*" | ||
] | ||
} |