-
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.
- Loading branch information
Showing
25 changed files
with
204 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,23 @@ | ||
import type { FromSchema } from "json-schema-to-ts"; | ||
|
||
export interface Attributes { | ||
mana: number; | ||
maxMana: number; | ||
health: number; | ||
maxHealth: number; | ||
} | ||
|
||
export const attributesSchema = { | ||
type: "object", | ||
properties: { | ||
mana: { type: "number" }, | ||
maxMana: { type: "number" }, | ||
health: { type: "number" }, | ||
maxHealth: { type: "number" }, | ||
}, | ||
required: ["mana", "maxMana", "health", "maxHealth"], | ||
additionalProperties: false, | ||
} as const; | ||
|
||
const a: Attributes = {} as FromSchema<typeof attributesSchema>; | ||
const b: FromSchema<typeof attributesSchema> = {} as Attributes; |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import type { FromSchema } from "json-schema-to-ts"; | ||
|
||
export type DateTime = string; | ||
|
||
export const dateTimeSchema = { | ||
type: "string", | ||
format: "date-time", | ||
} as const; | ||
|
||
const a: DateTime = {} as FromSchema<typeof dateTimeSchema>; | ||
const b: FromSchema<typeof dateTimeSchema> = {} as DateTime; |
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,12 @@ | ||
import type { FromSchema } from "json-schema-to-ts"; | ||
|
||
export type Grade = number; | ||
|
||
export const gradeSchema = { | ||
type: "integer", | ||
minimum: 0, | ||
maximum: 5, | ||
} as const; | ||
|
||
const a: Grade = {} as FromSchema<typeof gradeSchema>; | ||
const b: FromSchema<typeof gradeSchema> = {} as Grade; |
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,11 +1,31 @@ | ||
import type { Appellation } from "./appellation"; | ||
import { appellationSchema, type Appellation } from "./appellation"; | ||
import type { Block } from "blockwise"; | ||
import type { Attributes } from "./attributes"; | ||
import { attributesSchema, type Attributes } from "./attributes"; | ||
import { gradeSchema, type Grade } from "./grade"; | ||
import type { FromSchema } from "json-schema-to-ts"; | ||
import { blockSchema } from "blockwise"; | ||
import { uidSchema } from "./uid"; | ||
|
||
export interface Hero { | ||
id: string; | ||
appellation: Appellation; | ||
grade: number; | ||
grade: Grade; | ||
position: Block; | ||
attributes: Attributes; | ||
} | ||
|
||
export const heroSchema = { | ||
type: "object", | ||
required: ["id", "appellation", "grade", "position", "attributes"], | ||
properties: { | ||
id: uidSchema, | ||
appellation: appellationSchema, | ||
grade: gradeSchema, | ||
position: blockSchema, | ||
attributes: attributesSchema, | ||
}, | ||
additionalProperties: false, | ||
} as const; | ||
|
||
const a: Hero = {} as FromSchema<typeof heroSchema>; | ||
const b: FromSchema<typeof heroSchema> = {} as Hero; |
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 |
---|---|---|
@@ -1 +1,10 @@ | ||
import type { FromSchema } from "json-schema-to-ts"; | ||
|
||
export type Level = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; | ||
|
||
export const levelSchema = { | ||
enum: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | ||
} as const; | ||
|
||
const a: FromSchema<typeof levelSchema> = {} as Level; | ||
const b: Level = {} as FromSchema<typeof levelSchema>; |
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
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,11 @@ | ||
import type { FromSchema } from "json-schema-to-ts"; | ||
|
||
export type Uid = string; | ||
|
||
export const uidSchema = { | ||
type: "string", | ||
format: "uuid", | ||
} as const; | ||
|
||
const a: Uid = {} as FromSchema<typeof uidSchema>; | ||
const b: FromSchema<typeof uidSchema> = {} as Uid; |
Empty file.
Oops, something went wrong.