-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(types): composition node (#5527)
- Loading branch information
Showing
5 changed files
with
40 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Chart, CompositionNode, MarkNode } from '../../../src'; | ||
|
||
describe('types', () => { | ||
const chart = new Chart(); | ||
|
||
test('CompositionNode', () => { | ||
const rect: CompositionNode = chart.facetRect(); | ||
rect.boxplot(); | ||
}); | ||
|
||
test('MarkNode', () => { | ||
const interval: MarkNode = chart.interval(); | ||
interval.encode('x', 'name'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
import { G2Spec } from '../spec'; | ||
import { extend, API } from './extend'; | ||
import { extend, API, CompositionAPI } from './extend'; | ||
import { library } from './library'; | ||
import { Runtime } from './runtime'; | ||
import { MarkNode as Node } from './mark'; | ||
import type { RuntimeOptions } from './runtime'; | ||
|
||
export interface Chart extends API<G2Spec, typeof library> {} | ||
|
||
export interface CompositionNode extends CompositionAPI<typeof library> {} | ||
|
||
export interface MarkNode extends Node {} | ||
|
||
export const Chart = extend(Runtime, library); | ||
|
||
export type ChartOptions = Omit<RuntimeOptions, 'lib'>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
export { Chart, type ChartOptions } from './chart'; | ||
export { MarkNode } from './mark'; | ||
export { CompositionNode } from './composition'; | ||
export { | ||
Chart, | ||
type ChartOptions, | ||
type MarkNode, | ||
type CompositionNode, | ||
} from './chart'; | ||
export { register } from './library'; | ||
export { Runtime } from './runtime'; | ||
export { extend } from './extend'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters