Adds references

This commit is contained in:
Steve Ruiz 2021-09-06 12:44:14 +01:00
parent 9f2148eab9
commit 7d37cf34c1
7 changed files with 37 additions and 18 deletions

View file

@ -3,6 +3,7 @@
"include": ["src"], "include": ["src"],
"exclude": ["node_modules", "dist", "docs"], "exclude": ["node_modules", "dist", "docs"],
"compilerOptions": { "compilerOptions": {
"composite": true,
"emitDeclarationOnly": true, "emitDeclarationOnly": true,
"rootDir": "src", "rootDir": "src",
"outDir": "./dist/types", "outDir": "./dist/types",

View file

@ -1,5 +1,5 @@
import * as React from 'react' import * as React from 'react'
import { TLDraw, TLDrawState } from '@tldraw/tldraw' import { TLDraw, TLDrawShapeType, TLDrawState } from '@tldraw/tldraw'
export default function Editor(): JSX.Element { export default function Editor(): JSX.Element {
const rTLDrawState = React.useRef<TLDrawState>() const rTLDrawState = React.useRef<TLDrawState>()
@ -13,7 +13,7 @@ export default function Editor(): JSX.Element {
state.selectAll() state.selectAll()
state.createShapes({ state.createShapes({
id: 'rect1', id: 'rect1',
type: 'rectangle', type: TLDrawShapeType.Rectangle,
point: [100, 100], point: [100, 100],
size: [200, 200], size: [200, 200],
}) })

View file

@ -3,8 +3,12 @@
"include": ["src"], "include": ["src"],
"exclude": ["node_modules", "**/*.test.ts", "**/*.spec.ts", "dist"], "exclude": ["node_modules", "**/*.test.ts", "**/*.spec.ts", "dist"],
"compilerOptions": { "compilerOptions": {
"rootDir": "src", "composite": true
"outDir": "./dist/types", },
"baseUrl": "src" "references": [
} {
"path": "../../packages/tldraw"
},
{ "path": "../../packages/core" }
]
} }

View file

@ -3,6 +3,7 @@
"include": ["src"], "include": ["src"],
"exclude": ["node_modules", "dist", "docs"], "exclude": ["node_modules", "dist", "docs"],
"compilerOptions": { "compilerOptions": {
"composite": true,
"emitDeclarationOnly": true, "emitDeclarationOnly": true,
"rootDir": "src", "rootDir": "src",
"outDir": "./dist/types", "outDir": "./dist/types",
@ -10,5 +11,6 @@
"paths": { "paths": {
"~*": ["./*"] "~*": ["./*"]
} }
} },
"references": [{ "path": "../../packages/core" }]
} }

View file

@ -1,5 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"composite": true,
"target": "es5", "target": "es5",
"lib": ["dom", "dom.iterable", "esnext"], "lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true, "allowJs": true,
@ -20,5 +21,11 @@
} }
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"] "exclude": ["node_modules"],
"references": [
{
"path": "../../packages/tldraw"
},
{ "path": "../../packages/core" }
]
} }

View file

@ -1,31 +1,33 @@
{ {
"compilerOptions": { "compilerOptions": {
"allowSyntheticDefaultImports": true, // For references
"declaration": true, "declaration": true,
"declarationMap": true,
"sourceMap": true,
// Other
"allowSyntheticDefaultImports": true,
"esModuleInterop": true, "esModuleInterop": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "error",
"stripInternal": true,
"incremental": true,
"importHelpers": true, "importHelpers": true,
"importsNotUsedAsValues": "error",
"incremental": true,
"jsx": "preserve",
"lib": ["dom", "esnext"],
"module": "esnext",
"moduleResolution": "node", "moduleResolution": "node",
"declarationMap": true,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */, "noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noUnusedLocals": false /* Report errors on unused locals. */, "noUnusedLocals": false /* Report errors on unused locals. */,
"noUnusedParameters": false /* Report errors on unused parameters. */, "noUnusedParameters": false /* Report errors on unused parameters. */,
"skipLibCheck": true, "skipLibCheck": true,
"sourceMap": true,
"strict": false, "strict": false,
"strictFunctionTypes": true /* Enable strict checking of function types. */, "strictFunctionTypes": true /* Enable strict checking of function types. */,
"strictNullChecks": true /* Enable strict null checks. */, "strictNullChecks": true /* Enable strict null checks. */,
"stripInternal": true,
"target": "es6", "target": "es6",
"typeRoots": ["node_modules/@types", "node_modules/jest"], "typeRoots": ["node_modules/@types", "node_modules/jest"],
"types": ["node", "jest"], "types": ["node", "jest"]
"jsx": "preserve",
"lib": ["dom", "esnext"],
"module": "esnext"
} }
} }

View file

@ -1,6 +1,9 @@
{ {
"composite": true,
"extends": "./tsconfig.base.json", "extends": "./tsconfig.base.json",
"exclude": ["node_modules", "**/*.test.ts", "**/*.spec.ts"], "exclude": ["node_modules", "**/*.test.ts", "**/*.spec.ts"],
"files": [],
"references": [{ "path": "./packages/tldraw" }, { "path": "./packages/core" }],
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {