[fix] typescript types (#721)

* fix types

* Update .eslintrc.json
This commit is contained in:
Steve Ruiz 2022-06-16 09:09:48 +01:00 committed by GitHub
parent e8459adc6b
commit ef9d457a14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 95 deletions

View file

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable @typescript-eslint/no-non-null-assertion */
import { TDDocument, TDFile, Tldraw, TldrawApp } from '@tldraw/tldraw' import { TDDocument, TDFile, Tldraw, TldrawApp } from '@tldraw/tldraw'
import * as React from 'react' import * as React from 'react'
import { exportToImage } from 'utils/export'
import type { MessageFromExtension, MessageFromWebview } from './types' import type { MessageFromExtension, MessageFromWebview } from './types'
import { defaultDocument } from './utils/defaultDocument' import { defaultDocument } from './utils/defaultDocument'
import { vscode } from './utils/vscode' import { vscode } from './utils/vscode'
@ -10,7 +9,7 @@ import { vscode } from './utils/vscode'
declare let currentFile: TDFile declare let currentFile: TDFile
declare let assetSrc: string declare let assetSrc: string
const App: React.FC = () => { const App = () => {
const rLoaded = React.useRef(false) const rLoaded = React.useRef(false)
const rTldrawApp = React.useRef<TldrawApp>() const rTldrawApp = React.useRef<TldrawApp>()
const rInitialDocument = React.useRef<TDDocument>( const rInitialDocument = React.useRef<TDDocument>(

View file

@ -1,3 +1,6 @@
{ {
"extends": "next/core-web-vitals" "extends": "next/core-web-vitals",
"rules": {
"@typescript-eslint/no-explicit-any": "off"
}
} }

View file

@ -12,12 +12,12 @@ interface EditorProps {
isSponsor?: boolean isSponsor?: boolean
} }
const Editor: React.FC<EditorProps & Partial<TldrawProps>> = ({ const Editor = ({
id = 'home', id = 'home',
isUser = false, isUser = false,
isSponsor = false, isSponsor = false,
...rest ...rest
}) => { }: EditorProps & Partial<TldrawProps>) => {
const handleMount = React.useCallback((app: TldrawApp) => { const handleMount = React.useCallback((app: TldrawApp) => {
window.app = app window.app = app
}, []) }, [])

View file

@ -6,7 +6,7 @@ import { useTLTheme, TLContext, TLContextType } from '../hooks'
import { Inputs } from '~inputs' import { Inputs } from '~inputs'
import type { BoxShape } from '~TLShapeUtil/TLShapeUtil.spec' import type { BoxShape } from '~TLShapeUtil/TLShapeUtil.spec'
export const ContextWrapper: React.FC = ({ children }) => { export const ContextWrapper = ({ children }: { children: any }) => {
useTLTheme() useTLTheme()
const rSelectionBounds = React.useRef<TLBounds>(null) const rSelectionBounds = React.useRef<TLBounds>(null)
const rPageState = React.useRef<TLPageState>(mockDocument.pageState) const rPageState = React.useRef<TLPageState>(mockDocument.pageState)

View file

@ -4,7 +4,7 @@ import { useKeyboardShortcuts, TldrawContext } from '~hooks'
import { mockDocument } from './mockDocument' import { mockDocument } from './mockDocument'
import { render } from '@testing-library/react' import { render } from '@testing-library/react'
export const Wrapper: React.FC = ({ children }) => { export const Wrapper = ({ children }: { children: any }) => {
const [app] = React.useState(() => new TldrawApp()) const [app] = React.useState(() => new TldrawApp())
const [context] = React.useState(() => { const [context] = React.useState(() => {
return app return app

View file

@ -2193,22 +2193,6 @@
"@babel/runtime" "^7.13.10" "@babel/runtime" "^7.13.10"
"@radix-ui/react-primitive" "0.1.4" "@radix-ui/react-primitive" "0.1.4"
"@radix-ui/react-checkbox@^0.1.5":
version "0.1.5"
resolved "https://registry.yarnpkg.com/@radix-ui/react-checkbox/-/react-checkbox-0.1.5.tgz#3a6bd54ba1720c8e5c03852acf460e35dfbe9da3"
integrity sha512-M8Y4dSXsKSbF+FryG5VvZKr/1MukMVG7swq9p5s7wYb8Rvn0UM0rQ5w8BWmSWSV4BL/gbJdhwVCznwXXlgZRZg==
dependencies:
"@babel/runtime" "^7.13.10"
"@radix-ui/primitive" "0.1.0"
"@radix-ui/react-compose-refs" "0.1.0"
"@radix-ui/react-context" "0.1.1"
"@radix-ui/react-label" "0.1.5"
"@radix-ui/react-presence" "0.1.2"
"@radix-ui/react-primitive" "0.1.4"
"@radix-ui/react-use-controllable-state" "0.1.0"
"@radix-ui/react-use-previous" "0.1.1"
"@radix-ui/react-use-size" "0.1.1"
"@radix-ui/react-collection@0.1.4": "@radix-ui/react-collection@0.1.4":
version "0.1.4" version "0.1.4"
resolved "https://registry.yarnpkg.com/@radix-ui/react-collection/-/react-collection-0.1.4.tgz#734061ffd5bb93e88889d49b87391a73a63824c9" resolved "https://registry.yarnpkg.com/@radix-ui/react-collection/-/react-collection-0.1.4.tgz#734061ffd5bb93e88889d49b87391a73a63824c9"
@ -2324,17 +2308,6 @@
"@babel/runtime" "^7.13.10" "@babel/runtime" "^7.13.10"
"@radix-ui/react-use-layout-effect" "0.1.0" "@radix-ui/react-use-layout-effect" "0.1.0"
"@radix-ui/react-label@0.1.5":
version "0.1.5"
resolved "https://registry.yarnpkg.com/@radix-ui/react-label/-/react-label-0.1.5.tgz#12cd965bfc983e0148121d4c99fb8e27a917c45c"
integrity sha512-Au9+n4/DhvjR0IHhvZ1LPdx/OW+3CGDie30ZyCkbSHIuLp4/CV4oPPGBwJ1vY99Jog3zyQhsGww9MXj8O9Aj/A==
dependencies:
"@babel/runtime" "^7.13.10"
"@radix-ui/react-compose-refs" "0.1.0"
"@radix-ui/react-context" "0.1.1"
"@radix-ui/react-id" "0.1.5"
"@radix-ui/react-primitive" "0.1.4"
"@radix-ui/react-menu@0.1.6": "@radix-ui/react-menu@0.1.6":
version "0.1.6" version "0.1.6"
resolved "https://registry.yarnpkg.com/@radix-ui/react-menu/-/react-menu-0.1.6.tgz#7f9521a10f6a9cd819b33b33d5ed9538d79b2e75" resolved "https://registry.yarnpkg.com/@radix-ui/react-menu/-/react-menu-0.1.6.tgz#7f9521a10f6a9cd819b33b33d5ed9538d79b2e75"
@ -2400,23 +2373,6 @@
"@babel/runtime" "^7.13.10" "@babel/runtime" "^7.13.10"
"@radix-ui/react-slot" "0.1.2" "@radix-ui/react-slot" "0.1.2"
"@radix-ui/react-radio-group@^0.1.5":
version "0.1.5"
resolved "https://registry.yarnpkg.com/@radix-ui/react-radio-group/-/react-radio-group-0.1.5.tgz#ca8a676123a18b44804aff10af46129e2c2b37c3"
integrity sha512-ybgHsmh/V2crKvK6xZ56dpPul7b+vyxcq7obWqHbr5W6Ca11wdm0E7lS0i/Y6pgfIKYOWIARmZYDpRMEeRCPOw==
dependencies:
"@babel/runtime" "^7.13.10"
"@radix-ui/primitive" "0.1.0"
"@radix-ui/react-compose-refs" "0.1.0"
"@radix-ui/react-context" "0.1.1"
"@radix-ui/react-label" "0.1.5"
"@radix-ui/react-presence" "0.1.2"
"@radix-ui/react-primitive" "0.1.4"
"@radix-ui/react-roving-focus" "0.1.5"
"@radix-ui/react-use-controllable-state" "0.1.0"
"@radix-ui/react-use-previous" "0.1.1"
"@radix-ui/react-use-size" "0.1.1"
"@radix-ui/react-roving-focus@0.1.5": "@radix-ui/react-roving-focus@0.1.5":
version "0.1.5" version "0.1.5"
resolved "https://registry.yarnpkg.com/@radix-ui/react-roving-focus/-/react-roving-focus-0.1.5.tgz#cc48d17a36b56f253d54905b0fd60ee134cb97ee" resolved "https://registry.yarnpkg.com/@radix-ui/react-roving-focus/-/react-roving-focus-0.1.5.tgz#cc48d17a36b56f253d54905b0fd60ee134cb97ee"
@ -2956,44 +2912,6 @@
"@testing-library/dom" "^8.5.0" "@testing-library/dom" "^8.5.0"
"@types/react-dom" "^18.0.0" "@types/react-dom" "^18.0.0"
"@tldraw/core@*", "@tldraw/core@^1.13.1":
version "1.13.1"
resolved "https://registry.yarnpkg.com/@tldraw/core/-/core-1.13.1.tgz#b56f919b23f941dfe1842238131ccee7da19e2cd"
integrity sha512-tvQGi5Up2WriLVTtJbWNanchd03hUX5e3g/iRPptOacDlygQTX6XtfBa+4VA0F3vDwzoxeCTe2smpNMTbhKM1g==
dependencies:
"@tldraw/intersect" "^1.7.1"
"@tldraw/vec" "^1.7.0"
"@use-gesture/react" "^10.2.14"
mobx-react-lite "^3.2.3"
perfect-freehand "^1.1.0"
resize-observer-polyfill "^1.5.1"
"@tldraw/tldraw@*":
version "1.15.1"
resolved "https://registry.yarnpkg.com/@tldraw/tldraw/-/tldraw-1.15.1.tgz#f27cd992e96dd68f1ad3243e04c5964a19db6b2b"
integrity sha512-76RBv5urQAi/PBKfnENxfS/pZkwkJD5/LfCioreWAo8+ZYit0wRGzF8e5uii1INEibPpz/hgQz6W/4SU64m8vA==
dependencies:
"@radix-ui/react-alert-dialog" "^0.1.7"
"@radix-ui/react-checkbox" "^0.1.5"
"@radix-ui/react-context-menu" "^0.1.6"
"@radix-ui/react-dropdown-menu" "^0.1.6"
"@radix-ui/react-icons" "^1.1.1"
"@radix-ui/react-radio-group" "^0.1.5"
"@radix-ui/react-tooltip" "^0.1.7"
"@stitches/react" "^1.2.8"
"@tldraw/core" "^1.13.1"
"@tldraw/intersect" "^1.7.1"
"@tldraw/vec" "^1.7.0"
"@types/lz-string" "^1.3.34"
idb-keyval "^6.1.0"
lz-string "^1.4.4"
perfect-freehand "^1.1.0"
react-error-boundary "^3.1.4"
react-hotkey-hook "^1.0.2"
react-hotkeys-hook "^3.4.4"
tslib "^2.3.1"
zustand "^3.6.9"
"@tootallnate/once@1": "@tootallnate/once@1":
version "1.1.2" version "1.1.2"
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
@ -9629,11 +9547,6 @@ react-feather@^2.0.9:
dependencies: dependencies:
prop-types "^15.7.2" prop-types "^15.7.2"
react-hotkey-hook@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/react-hotkey-hook/-/react-hotkey-hook-1.0.2.tgz#ca17a3f806092027eaaf41fd2f111afd9926e3ab"
integrity sha512-95GiOW8ORMqbBQ23+VHMF0giRmpiI8sFHPjbOR/e64zWI0QT+QO3Q/022c0HNBS/LrQsbGdjm64BNMah0WvlnA==
react-hotkeys-hook@^3.4.4: react-hotkeys-hook@^3.4.4:
version "3.4.4" version "3.4.4"
resolved "https://registry.yarnpkg.com/react-hotkeys-hook/-/react-hotkeys-hook-3.4.4.tgz#52ba5d8ef5e47cc2e776c70a9036d518e0993d51" resolved "https://registry.yarnpkg.com/react-hotkeys-hook/-/react-hotkeys-hook-3.4.4.tgz#52ba5d8ef5e47cc2e776c70a9036d518e0993d51"
@ -10986,7 +10899,7 @@ tsconfig-replace-paths@^0.0.11:
globby "^10.0.1" globby "^10.0.1"
json5 "^2.2.0" json5 "^2.2.0"
tslib@2.4.0, tslib@^2.3.1, tslib@^2.4.0: tslib@2.4.0, tslib@^2.4.0:
version "2.4.0" version "2.4.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3"
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==