-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/conditional-type
- Loading branch information
Showing
17 changed files
with
295 additions
and
16 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
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,5 @@ | ||
export class MyObject { | ||
public required: string; | ||
public optional?: number; | ||
[name: string]: string|number; | ||
} |
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,26 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"MyObject": { | ||
"type": "object", | ||
"properties": { | ||
"required": { | ||
"type": "string" | ||
}, | ||
"optional": { | ||
"type": "number" | ||
} | ||
}, | ||
"required": [ | ||
"required" | ||
], | ||
"additionalProperties": { | ||
"type": [ | ||
"string", | ||
"number" | ||
] | ||
} | ||
} | ||
}, | ||
"$ref": "#/definitions/MyObject" | ||
} |
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,9 @@ | ||
export class Base<T> { | ||
public a: T; | ||
} | ||
|
||
export class MyObject extends Base<number> { | ||
public b: string; | ||
public c: Base<string>; | ||
public d: Base<boolean>; | ||
} |
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,54 @@ | ||
{ | ||
"$ref": "#/definitions/MyObject", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"Base<boolean>": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"a": { | ||
"type": "boolean" | ||
} | ||
}, | ||
"required": [ | ||
"a" | ||
], | ||
"type": "object" | ||
}, | ||
"Base<string>": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"a": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"a" | ||
], | ||
"type": "object" | ||
}, | ||
"MyObject": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"a": { | ||
"type": "number" | ||
}, | ||
"b": { | ||
"type": "string" | ||
}, | ||
"c": { | ||
"$ref": "#/definitions/Base<string>" | ||
}, | ||
"d": { | ||
"$ref": "#/definitions/Base<boolean>" | ||
} | ||
}, | ||
"required": [ | ||
"a", | ||
"b", | ||
"c", | ||
"d" | ||
], | ||
"type": "object" | ||
} | ||
} | ||
} |
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,9 @@ | ||
export class Base { | ||
public a: number; | ||
public b: string | string; | ||
} | ||
|
||
export class MyObject extends Base { | ||
public c: boolean; | ||
public b: string; | ||
} |
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,26 @@ | ||
{ | ||
"$ref": "#/definitions/MyObject", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"MyObject": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"a": { | ||
"type": "number" | ||
}, | ||
"b": { | ||
"type": "string" | ||
}, | ||
"c": { | ||
"type": "boolean" | ||
} | ||
}, | ||
"required": [ | ||
"a", | ||
"b", | ||
"c" | ||
], | ||
"type": "object" | ||
} | ||
} | ||
} |
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,8 @@ | ||
export class MyObject { | ||
public subA: MySubObject; | ||
public subB: MySubObject; | ||
} | ||
export class MySubObject { | ||
public propA: number; | ||
public propB: number; | ||
} |
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,38 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"MyObject": { | ||
"type": "object", | ||
"properties": { | ||
"subA": { | ||
"$ref": "#/definitions/MySubObject" | ||
}, | ||
"subB": { | ||
"$ref": "#/definitions/MySubObject" | ||
} | ||
}, | ||
"required": [ | ||
"subA", | ||
"subB" | ||
], | ||
"additionalProperties": false | ||
}, | ||
"MySubObject": { | ||
"type": "object", | ||
"properties": { | ||
"propA": { | ||
"type": "number" | ||
}, | ||
"propB": { | ||
"type": "number" | ||
} | ||
}, | ||
"required": [ | ||
"propA", | ||
"propB" | ||
], | ||
"additionalProperties": false | ||
} | ||
}, | ||
"$ref": "#/definitions/MyObject" | ||
} |
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,4 @@ | ||
export class MyObject { | ||
public propA: number; | ||
public propB: MyObject; | ||
} |
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,22 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"definitions": { | ||
"MyObject": { | ||
"type": "object", | ||
"properties": { | ||
"propA": { | ||
"type": "number" | ||
}, | ||
"propB": { | ||
"$ref": "#/definitions/MyObject" | ||
} | ||
}, | ||
"required": [ | ||
"propA", | ||
"propB" | ||
], | ||
"additionalProperties": false | ||
} | ||
}, | ||
"$ref": "#/definitions/MyObject" | ||
} |
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,36 @@ | ||
export class MyObject { | ||
// Static properties must be ignored | ||
public static staticProp: number; | ||
|
||
public propA: number; | ||
public propB: number; | ||
|
||
// Properties without type must be ignored | ||
public noType; | ||
|
||
// Protected properties must be ignored | ||
protected protectedProp: string; | ||
|
||
// Protected properties must be ignored | ||
private privateProp: boolean; | ||
|
||
// Constructors must be ignored | ||
public constructor() { | ||
this.privateProp = false; | ||
} | ||
|
||
// Normal method must be ignored | ||
public getPrivateProp() { | ||
return this.privateProp; | ||
} | ||
|
||
// Getter methods must be ignored | ||
public get getterSetter(): number { | ||
return this.propA; | ||
} | ||
|
||
// Setter methods must be ignored | ||
public set getterSetter(value: number) { | ||
this.propA = value; | ||
} | ||
} |
Oops, something went wrong.