File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ to use a JSON Schema validator at runtime to enforce remaining constraints.
3636| Applicator (2020-12) | ` propertyNames ` | Ignored |
3737| Applicator (2020-12) | ` dependentSchemas ` | Pending |
3838| Applicator (2020-12) | ` contains ` | Ignored |
39- | Applicator (2020-12) | ` allOf ` | Pending |
39+ | Applicator (2020-12) | ` allOf ` | Yes |
4040| Applicator (2020-12) | ` oneOf ` | ** PARTIAL GIVEN LANGUAGE LIMITATIONS** |
4141| Applicator (2020-12) | ` not ` | ** CANNOT SUPPORT** |
4242| Applicator (2020-12) | ` if ` | Pending |
Original file line number Diff line number Diff line change 1+ export type AllOfIntersection_1Age = number ;
2+
3+ export type AllOfIntersection_1AdditionalProperties = never ;
4+
5+ export interface AllOfIntersection_1 {
6+ "age" : AllOfIntersection_1Age ;
7+ }
8+
9+ export type AllOfIntersection_0Name = string ;
10+
11+ export type AllOfIntersection_0AdditionalProperties = never ;
12+
13+ export interface AllOfIntersection_0 {
14+ "name" : AllOfIntersection_0Name ;
15+ }
16+
17+ export type AllOfIntersection =
18+ AllOfIntersection_0 &
19+ AllOfIntersection_1 ;
Original file line number Diff line number Diff line change 1+ {
2+ "defaultPrefix" : " AllOfIntersection"
3+ }
Original file line number Diff line number Diff line change 1+ {
2+ "$schema" : " https://json-schema.org/draft/2020-12/schema" ,
3+ "allOf" : [
4+ {
5+ "type" : " object" ,
6+ "properties" : {
7+ "name" : { "type" : " string" }
8+ },
9+ "required" : [ " name" ],
10+ "additionalProperties" : false
11+ },
12+ {
13+ "type" : " object" ,
14+ "properties" : {
15+ "age" : { "type" : " integer" }
16+ },
17+ "required" : [ " age" ],
18+ "additionalProperties" : false
19+ }
20+ ]
21+ }
Original file line number Diff line number Diff line change 1+ import { AllOfIntersection } from "./expected" ;
2+
3+ // Valid: satisfies both branches
4+ const valid : AllOfIntersection = {
5+ name : "Alice" ,
6+ age : 30
7+ } ;
8+
9+ // Invalid: missing age from second branch
10+ // @ts -expect-error
11+ const missingAge : AllOfIntersection = {
12+ name : "Bob"
13+ } ;
14+
15+ // Invalid: missing name from first branch
16+ // @ts -expect-error
17+ const missingName : AllOfIntersection = {
18+ age : 25
19+ } ;
Original file line number Diff line number Diff line change 1+ export type Person_1 = PersonAged ;
2+
3+ export type Person_0 = PersonNamed ;
4+
5+ export type PersonNamedName = string ;
6+
7+ export type PersonNamedAdditionalProperties = never ;
8+
9+ export interface PersonNamed {
10+ "name" : PersonNamedName ;
11+ }
12+
13+ export type PersonAgedAge = number ;
14+
15+ export type PersonAgedAdditionalProperties = never ;
16+
17+ export interface PersonAged {
18+ "age" : PersonAgedAge ;
19+ }
20+
21+ export type Person =
22+ Person_0 &
23+ Person_1 ;
Original file line number Diff line number Diff line change 1+ {
2+ "defaultPrefix" : " Person"
3+ }
Original file line number Diff line number Diff line change 1+ {
2+ "$schema" : " https://json-schema.org/draft/2020-12/schema" ,
3+ "$defs" : {
4+ "Named" : {
5+ "type" : " object" ,
6+ "properties" : {
7+ "name" : { "type" : " string" }
8+ },
9+ "required" : [ " name" ],
10+ "additionalProperties" : false
11+ },
12+ "Aged" : {
13+ "type" : " object" ,
14+ "properties" : {
15+ "age" : { "type" : " integer" }
16+ },
17+ "required" : [ " age" ],
18+ "additionalProperties" : false
19+ }
20+ },
21+ "allOf" : [
22+ { "$ref" : " #/$defs/Named" },
23+ { "$ref" : " #/$defs/Aged" }
24+ ]
25+ }
Original file line number Diff line number Diff line change 1+ import { Person } from "./expected" ;
2+
3+ // Valid: satisfies both $ref branches
4+ const valid : Person = {
5+ name : "Alice" ,
6+ age : 30
7+ } ;
8+
9+ // Invalid: missing age
10+ // @ts -expect-error
11+ const missingAge : Person = {
12+ name : "Bob"
13+ } ;
14+
15+ // Invalid: missing name
16+ // @ts -expect-error
17+ const missingName : Person = {
18+ age : 25
19+ } ;
Original file line number Diff line number Diff line change 1+ export type Wrapper_0Value = string ;
2+
3+ export type Wrapper_0AdditionalProperties = never ;
4+
5+ export interface Wrapper_0 {
6+ "value" : Wrapper_0Value ;
7+ }
8+
9+ export type Wrapper = Wrapper_0 ;
You can’t perform that action at this time.
0 commit comments