Skip to content

Commit beee40c

Browse files
authored
chore(vscode): simplify types (#4456)
1 parent bdc2c94 commit beee40c

5 files changed

Lines changed: 13 additions & 10 deletions

File tree

vscode/react/src/components/graph/ModelNode.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Position, type NodeProps } from 'reactflow'
88
import { type Column } from '@/api/client'
99
import ModelNodeHeaderHandles from './ModelNodeHeaderHandles'
1010
import ModelColumns from './ModelColumns'
11+
import type { Model } from '@/domain/model'
1112

1213
export const EnumLineageNodeModelType = {
1314
...ModelType,

vscode/react/src/components/graph/context.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import {
99
import { getNodeMap, hasActiveEdge, hasActiveEdgeConnector } from './help'
1010
import { EnumSide } from './types'
1111
import { type Node } from 'reactflow'
12+
import type { Lineage } from '@/domain/lineage'
13+
import type { ModelSQLMeshModel } from '@/domain/sqlmesh-model'
14+
import type { Model } from '@/domain/model'
1215
export interface Connections {
1316
left: string[]
1417
right: string[]
@@ -19,10 +22,6 @@ export type ActiveNodes = Set<string>
1922
export type SelectedNodes = Set<string>
2023
export type HighlightedNodes = Record<string, string[]>
2124

22-
type Lineage = any
23-
type ModelSQLMeshModel = any
24-
type Model = any
25-
2625
interface LineageFlow {
2726
lineage: Record<string, Lineage>
2827
lineageCache?: Record<string, Lineage>
@@ -33,7 +32,7 @@ interface LineageFlow {
3332
selectedNodes: SelectedNodes
3433
selectedEdges: any[]
3534
models: Record<string, Model>
36-
unknownModels: Record<string, Model>
35+
unknownModels: Set<string>
3736
connections: Map<string, Connections>
3837
withConnected: boolean
3938
withColumns: boolean
@@ -84,7 +83,7 @@ export const LineageFlowContext = createContext<LineageFlow>({
8483
mainNode: undefined,
8584
activeEdges: new Map(),
8685
activeNodes: new Set(),
87-
models: new Map(),
86+
models: {},
8887
unknownModels: new Set(),
8988
manuallySelectedColumn: undefined,
9089
connections: new Map(),

vscode/react/src/components/graph/help.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import {
1717
} from './ModelNode'
1818
import type { Lineage } from '@/domain/lineage'
1919
import type { ConnectedNode } from '@/workers/lineage'
20-
21-
type ModelSQLMeshModel = any
20+
import type { ModelSQLMeshModel } from '@/domain/sqlmesh-model'
2221

2322
export interface GraphNodeData {
2423
label: string

vscode/react/src/domain/model.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
interface Model {
1+
import type { Column } from '@/api/client'
2+
3+
export interface Model {
4+
displayName: string
25
name: string
36
fqn: string
47
path: string
58
dialect: string
69
full_path: string
710
// type: ModelType
8-
// columns: Column[]
11+
columns: Column[]
912
// default_catalog?: ModelDefaultCatalog
1013
// description?: ModelDescription
1114
// sql?: ModelSql

vscode/react/src/pages/lineage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { ModelSQLMeshModel } from '@/domain/sqlmesh-model'
1414
import { useEventBus } from '@/hooks/eventBus'
1515
import type { VSCodeEvent } from '@bus/callbacks'
1616
import { URI } from 'vscode-uri'
17+
import type { Model } from '@/domain/model'
1718

1819
export function LineagePage() {
1920
const { emit } = useEventBus()

0 commit comments

Comments
 (0)