devicescript icon indicating copy to clipboard operation
devicescript copied to clipboard

better strategy needed to share custom services

Open pelikhan opened this issue 1 year ago • 1 comments

The @devicescript/test uses a custom service, for which the client gets compiled to the spec file.

However, this breaks reusability since compilation fails when trying to use this package from other packages.

using devs: v1.11.0, runtime: v6.3.0, node: v18.12.1 from /Users/peli/Documents/devicescript/cli/built
../../../../node_modules/@devicescript/test/src/core.ts:1:29 - error TS2305: Module '"@devicescript/core"' has no exported member 'TestManager'.

1 import { AsyncVoid, reboot, TestManager } from "@devicescript/core"
                              ~~~~~~~~~~~
../../../../node_modules/@devicescript/test/src/core.ts:239:47 - error TS7006: Parameter 'path' implicitly has an 'any' type.

239     await testManager.runTest.subscribe(async path => {
                                                  ~~~~
../../../../node_modules/@devicescript/test/src/core.ts:39:25 - error TS9999: unknown name: TestManager

39 const testManager = new TestManager()

pelikhan avatar Mar 11 '23 00:03 pelikhan

In typescript 5, ts will resolve unknown file extensions by looking for a .d.ts file adjacent to the file.

https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#allowarbitraryextensions

pelikhan avatar Mar 17 '23 10:03 pelikhan