From b82b8abfac5bd8b5be2f80db4bf2004097f71934 Mon Sep 17 00:00:00 2001 From: Kanit Wongsuphasawat Date: Fri, 9 Jun 2017 10:54:12 -0700 Subject: [PATCH] Manually declare SingleDefChannel as this leads to error with `npm run schema` --- build/vega-lite-schema.json | 23 +++++++++++++++++++++-- src/channel.ts | 5 ++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/build/vega-lite-schema.json b/build/vega-lite-schema.json index 75176873cf..c3cd94c4d2 100644 --- a/build/vega-lite-schema.json +++ b/build/vega-lite-schema.json @@ -621,7 +621,7 @@ }, "encodings": { "items": { - "type": "string" + "$ref": "#/definitions/SingleDefChannel" }, "type": "array" }, @@ -4208,7 +4208,7 @@ }, "encodings": { "items": { - "type": "string" + "$ref": "#/definitions/SingleDefChannel" }, "type": "array" }, @@ -4325,6 +4325,25 @@ "string" ] }, + "SingleDefChannel": { + "enum": [ + "x", + "y", + "x2", + "y2", + "row", + "column", + "size", + "shape", + "color", + "opacity", + "text", + "tooltip" + ], + "type": [ + "string" + ] + }, "SortField": { "additionalProperties": false, "properties": { diff --git a/src/channel.ts b/src/channel.ts index 679edb8450..a25594abf9 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -57,7 +57,10 @@ const CHANNEL_INDEX = toSet(CHANNELS); export const SINGLE_DEF_CHANNELS = [X, Y, X2, Y2, ROW, COLUMN, SIZE, SHAPE, COLOR, OPACITY, TEXT, TOOLTIP]; -export type SingleDefChannel = typeof SINGLE_DEF_CHANNELS[0]; +// export type SingleDefChannel = typeof SINGLE_DEF_CHANNELS[0]; +// FIXME somehow the typeof above leads to the following error when running npm run schema +// UnknownNodeError: Unknown node "SingleDefChannel" (ts.SyntaxKind = 171) at /Users/kanitw/Documents/_code/_idl/_visrec/vega-lite/src/selection.ts(17,14) +export type SingleDefChannel = 'x' | 'y' | 'x2' | 'y2' | 'row' | 'column' | 'size' | 'shape' | 'color' | 'opacity' | 'text' | 'tooltip'; export function isChannel(str: string): str is Channel { return !!CHANNEL_INDEX[str];