diff --git a/test/__snapshots__/main.test.ts.snap b/test/__snapshots__/main.test.ts.snap index 4bcca92..b0bbab9 100644 --- a/test/__snapshots__/main.test.ts.snap +++ b/test/__snapshots__/main.test.ts.snap @@ -123,6 +123,18 @@ export const CreateCampingError = t.union([ }, 'OtherError') ], 'CreateCampingError') +export interface SingleCaseTaggedUnion { + x: number, + y: string, + _type: 'SingleCase' +} + +export const SingleCaseTaggedUnion = t.type({ + x: t.Integer, + y: t.string, + _type: t.literal('SingleCase') +}, 'SingleCase') + export type Surface = | { _type: 'Sand' diff --git a/test/source-tagged-unions.json b/test/source-tagged-unions.json index 5315d3d..5e86343 100644 --- a/test/source-tagged-unions.json +++ b/test/source-tagged-unions.json @@ -87,6 +87,40 @@ ], "desc": "Surface of the camping site", "_type": "TaggedUnion" + }, + { + "name": "SingleCaseTaggedUnion", + "values": [ + { + "name": "SingleCase", + "params": [ + { + "name": "x", + "tpe": { + "name": "Int", + "_type": "Name" + } + }, + { + "name": "y", + "tpe": { + "name": "String", + "_type": "Name" + } + } + ], + "desc": "Its only case", + "isValueClass": false + } + ], + "desc": "Not really much of a union", + "_type": "TaggedUnion" + }, + { + "name": "ZeroCaseTaggedUnion", + "values": [], + "desc": "Nothing at all in here", + "_type": "TaggedUnion" } ] }