diff --git a/package-lock.json b/package-lock.json index 7a73f8067..009fa50ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,6 +44,7 @@ "puppeteer": "^19.4.1", "sinon": "^15.0.0", "sinon-chai": "^3.7.0", + "typescript": "^4.9.4", "webpack": "^5.74.0" } }, @@ -7220,6 +7221,19 @@ "node": ">= 0.6" } }, + "node_modules/typescript": { + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/ua-parser-js": { "version": "0.7.31", "dev": true, @@ -12504,6 +12518,12 @@ } } }, + "typescript": { + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", + "dev": true + }, "ua-parser-js": { "version": "0.7.31", "dev": true diff --git a/package.json b/package.json index e43c86d77..0e89a4288 100644 --- a/package.json +++ b/package.json @@ -12,10 +12,11 @@ "!.eslintrc" ], "scripts": { - "all": "run-s lint test", + "all": "run-s lint test test:types", "lint": "eslint .", "dev": "npm test -- --auto-watch --no-single-run", - "test": "karma start" + "test": "karma start", + "test:types": "tsc" }, "repository": { "type": "git", @@ -64,6 +65,7 @@ "puppeteer": "^19.4.1", "sinon": "^15.0.0", "sinon-chai": "^3.7.0", + "typescript": "^4.9.4", "webpack": "^5.74.0" }, "dependencies": { diff --git a/test/spec/types/test.ts b/test/spec/types/test.ts deleted file mode 100644 index f97e6682f..000000000 --- a/test/spec/types/test.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { - Base, - Connection, - Label, - Root, - Shape -} from "../../../lib/model"; - -import Diagram from '../../../lib/Diagram'; - -import CoreModule from '../../../lib/core'; -import ModelingModule from '../../../lib/features/modeling'; - -import CommandInterceptor from "../../../lib/command/CommandInterceptor"; - -import Canvas from "../../../lib/core/Canvas"; -import ElementFactory from "../../../lib/core/ElementFactory"; -import ElementRegistry from "../../../lib/core/ElementRegistry"; -import EventBus from "../../../lib/core/EventBus"; -import GraphicsFactory from "../../../lib/core/GraphicsFactory"; -import Modeling from "../../../lib/features/modeling/Modeling"; - -class MyCommandInterceptor extends CommandInterceptor { - _eventBus: EventBus; - _modeling: Modeling; - - constructor(eventBus: EventBus, modeling: Modeling) { - super(eventBus); - - this._eventBus = eventBus; - this._modeling = modeling; - - this.postExecuted([ 'foobar' ], (context) => { - const { shape } = context; - - modeling.moveShape(shape, { x: 100, y: 100 }); - - // @ts-expect-error - modeling.moveShape({ x: 100, y: 100 }); - }, true); - } -} - - -MyCommandInterceptor.$inject = [ 'eventBus', 'modeling' ]; - -const diagram = new Diagram({ - modules: [ - CoreModule, - ModelingModule - ] -}); - -const elementFactory = diagram.get('elementFactory'); - -const connection = elementFactory.create('connection', { - id: 'connection', - source: new Base({ id: 'shape1' }), - target: new Base({ id: 'shape2' }), - waypoints: [] -}); - -const label = elementFactory.create