Skip to content

Commit

Permalink
Manually declare SingleDefChannel as this leads to error with `npm ru…
Browse files Browse the repository at this point in the history
…n schema`
  • Loading branch information
kanitw committed Jun 9, 2017
1 parent 46fbafe commit b82b8ab
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
23 changes: 21 additions & 2 deletions build/vega-lite-schema.json
Expand Up @@ -621,7 +621,7 @@
},
"encodings": {
"items": {
"type": "string"
"$ref": "#/definitions/SingleDefChannel"
},
"type": "array"
},
Expand Down Expand Up @@ -4208,7 +4208,7 @@
},
"encodings": {
"items": {
"type": "string"
"$ref": "#/definitions/SingleDefChannel"
},
"type": "array"
},
Expand Down Expand Up @@ -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": {
Expand Down
5 changes: 4 additions & 1 deletion src/channel.ts
Expand Up @@ -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];
Expand Down

1 comment on commit b82b8ab

@domoritz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.