How to use the ts-interface-checker.enumtype function in ts-interface-checker

To help you get started, we’ve selected a few ts-interface-checker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gristlabs / ts-interface-builder / test / fixtures / sample-ti.ts View on Github external
"tag": t.opt("string"),
});

export const ILRUCache = t.iface([], {
  "capacity": "number",
  "set": t.func("boolean", t.param("item", "ICacheItem"), t.param("overwrite", "boolean", true)),
  "get": t.func("ICacheItem", t.param("key", "string")),
});

export const MyType = t.union("boolean", "number", "ILRUCache");

export const NumberAlias = t.name("number");

export const NumberAlias2 = t.name("NumberAlias");

export const SomeEnum = t.enumtype({
  "Foo": 0,
  "Bar": 1,
});

export const Direction = t.enumtype({
  "Up": 1,
  "Down": 2,
  "Left": 17,
  "Right": 18,
});

export const DirectionStr = t.enumtype({
  "Up": "UP",
  "Down": "DOWN",
  "Left": "LEFT",
  "Right": "RIGHT",
github gristlabs / ts-interface-builder / test / fixtures / sample-ti.ts View on Github external
"Left": "LEFT",
  "Right": "RIGHT",
});

export const BooleanLikeHeterogeneousEnum = t.enumtype({
  "No": 0,
  "Yes": "YES",
});

export const EnumComputed = t.enumtype({
  "Foo": 0,
  "Bar": 17,
  "Baz": 16,
});

export const AnimalFlags = t.enumtype({
  "None": 0,
  "HasClaws": 1,
  "CanFly": 2,
  "EatsFish": 4,
  "Endangered": 8,
});

export const ISampling = t.iface(["ICacheItem"], {
  "xstring": "string",
  "xstring2": "string",
  "xany": "any",
  "xnumber": "number",
  "xnumber2": t.opt("number"),
  "xNumberAlias": "NumberAlias",
  "xNumberAlias2": "NumberAlias2",
  "xnull": "null",
github gristlabs / ts-interface-builder / test / fixtures / sample-ti.ts View on Github external
"Right": 18,
});

export const DirectionStr = t.enumtype({
  "Up": "UP",
  "Down": "DOWN",
  "Left": "LEFT",
  "Right": "RIGHT",
});

export const BooleanLikeHeterogeneousEnum = t.enumtype({
  "No": 0,
  "Yes": "YES",
});

export const EnumComputed = t.enumtype({
  "Foo": 0,
  "Bar": 17,
  "Baz": 16,
});

export const AnimalFlags = t.enumtype({
  "None": 0,
  "HasClaws": 1,
  "CanFly": 2,
  "EatsFish": 4,
  "Endangered": 8,
});

export const ISampling = t.iface(["ICacheItem"], {
  "xstring": "string",
  "xstring2": "string",
github gristlabs / ts-interface-builder / test / fixtures / sample-ti.ts View on Github external
export const Direction = t.enumtype({
  "Up": 1,
  "Down": 2,
  "Left": 17,
  "Right": 18,
});

export const DirectionStr = t.enumtype({
  "Up": "UP",
  "Down": "DOWN",
  "Left": "LEFT",
  "Right": "RIGHT",
});

export const BooleanLikeHeterogeneousEnum = t.enumtype({
  "No": 0,
  "Yes": "YES",
});

export const EnumComputed = t.enumtype({
  "Foo": 0,
  "Bar": 17,
  "Baz": 16,
});

export const AnimalFlags = t.enumtype({
  "None": 0,
  "HasClaws": 1,
  "CanFly": 2,
  "EatsFish": 4,
  "Endangered": 8,
github gristlabs / ts-interface-builder / test / fixtures / sample-ti.ts View on Github external
export const NumberAlias2 = t.name("NumberAlias");

export const SomeEnum = t.enumtype({
  "Foo": 0,
  "Bar": 1,
});

export const Direction = t.enumtype({
  "Up": 1,
  "Down": 2,
  "Left": 17,
  "Right": 18,
});

export const DirectionStr = t.enumtype({
  "Up": "UP",
  "Down": "DOWN",
  "Left": "LEFT",
  "Right": "RIGHT",
});

export const BooleanLikeHeterogeneousEnum = t.enumtype({
  "No": 0,
  "Yes": "YES",
});

export const EnumComputed = t.enumtype({
  "Foo": 0,
  "Bar": 17,
  "Baz": 16,
});
github gristlabs / ts-interface-builder / test / fixtures / sample-ti.ts View on Github external
"set": t.func("boolean", t.param("item", "ICacheItem"), t.param("overwrite", "boolean", true)),
  "get": t.func("ICacheItem", t.param("key", "string")),
});

export const MyType = t.union("boolean", "number", "ILRUCache");

export const NumberAlias = t.name("number");

export const NumberAlias2 = t.name("NumberAlias");

export const SomeEnum = t.enumtype({
  "Foo": 0,
  "Bar": 1,
});

export const Direction = t.enumtype({
  "Up": 1,
  "Down": 2,
  "Left": 17,
  "Right": 18,
});

export const DirectionStr = t.enumtype({
  "Up": "UP",
  "Down": "DOWN",
  "Left": "LEFT",
  "Right": "RIGHT",
});

export const BooleanLikeHeterogeneousEnum = t.enumtype({
  "No": 0,
  "Yes": "YES",