From e14ba296f28d772fb2f20c67e779518873b2eb86 Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Wed, 22 Sep 2021 09:30:42 +0200 Subject: [PATCH] Added examples/basic-dom to CI --- devEnv/typecheck-all-projects/tsconfig.all.json | 3 ++- examples/basic-dom/Scene.tsx | 12 ++++++++---- examples/basic-dom/tsconfig.json | 4 +++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/devEnv/typecheck-all-projects/tsconfig.all.json b/devEnv/typecheck-all-projects/tsconfig.all.json index 2d5b8ef..20f629a 100644 --- a/devEnv/typecheck-all-projects/tsconfig.all.json +++ b/devEnv/typecheck-all-projects/tsconfig.all.json @@ -9,6 +9,7 @@ {"path": "../../theatre"}, {"path": "../../packages/dataverse"}, {"path": "../../packages/playground"}, - {"path": "../../packages/r3f"} + {"path": "../../packages/r3f"}, + {"path": "../../examples/basic-dom"} ] } diff --git a/examples/basic-dom/Scene.tsx b/examples/basic-dom/Scene.tsx index 007e321..a9c503f 100644 --- a/examples/basic-dom/Scene.tsx +++ b/examples/basic-dom/Scene.tsx @@ -1,4 +1,4 @@ -import type {IScrub, IStudio} from '@theatre/studio' +import type {IScrub} from '@theatre/studio' import studio from '@theatre/studio' import React, {useLayoutEffect, useMemo, useState} from 'react' import type {ISheet, ISheetObject, IProject} from '@theatre/core' @@ -15,7 +15,7 @@ const boxObjectConfig = { const Box: React.FC<{ id: string sheet: ISheet - selectedObject: ISheetObject | undefined + selectedObject: ISheetObject | undefined }> = ({id, sheet, selectedObject}) => { // This is cheap to call and always returns the same value, so no need for useMemo() const obj = sheet.object(id, boxObjectConfig) @@ -92,11 +92,15 @@ export const Scene: React.FC<{project: IProject}> = ({project}) => { // This is cheap to call and always returns the same value, so no need for useMemo() const sheet = project.sheet('Scene', 'default') - const [selection, _setSelection] = useState([]) + const [selection, _setSelection] = useState>([]) useLayoutEffect(() => { return studio.onSelectionChange((newSelection) => { - _setSelection(newSelection) + _setSelection( + newSelection.filter( + (s): s is ISheetObject => s.type === 'Theatre_SheetObject_PublicAPI', + ), + ) }) }) diff --git a/examples/basic-dom/tsconfig.json b/examples/basic-dom/tsconfig.json index ce50bc0..a8849c8 100644 --- a/examples/basic-dom/tsconfig.json +++ b/examples/basic-dom/tsconfig.json @@ -3,7 +3,9 @@ "esModuleInterop": true, "jsx": "react", "skipDefaultLibCheck": true, - "skipLibCheck": true + "skipLibCheck": true, + "composite": true, + "noEmit": true }, "files": ["index.tsx", "Scene.tsx", "useDrag.ts"] }