Closed 4ov closed 3 years ago
Hi @lowray, thanks for raising this π
Having read the Deno manual (REF: https://deno.land/manual@v1.6.2/getting_started/typescript#code--no-checkcode-option) I believe this may be an issue with @garronej's https://github.com/garronej/evt library which Opine uses for it's eventing interface π’. Namely check out this part of the --no-check
docs:
To make the most of skipping type checks,
--no-check
transpiles each module in isolation without using information from imported modules. This maximizes potential for concurrency and incremental rebuilds. On the other hand, the transpiler cannot know ifexport { Foo } from "./foo.ts"
should be preserved (in caseFoo
is a value) or removed (in caseFoo
is strictly a type). To resolve such ambiguities, Deno enforcesisolatedModules
on all TS code. This means thatFoo
in the above example must be a value, and the export type syntax must be used instead ifFoo
is a type.
Which I believe may be the issue as CtxLike
which is re-exported in the index.ts
file in your error message (REF: https://deno.land/x/evt@v1.9.11/lib/types/interfaces/index.ts#L5) is an interface, not a value, and therefore not found when the --no-check
flag is provided.
...
export { CtxLike } from "./CtxLike.ts";
...
I wonder if instead the code should be something like...
/** https://docs.evt.land/api/ctx */
export type Ctx<Result> = import("./Ctx.ts").Ctx<Result>;
export type DoneOrAborted<Result> = import("./Ctx.ts").DoneOrAborted<Result>;
export type CtxLike = import("./CtxLike.ts").CtxLike; // Exported as a type in the same fashion as everything else?
/**
* Minimal interface that an object must implement to be a valid context argument
* ( for interop between mismatching EVT versions )
*/
export type VoidCtxLike = import("./CtxLike.ts").VoidCtxLike; // Wonder if this line also needs corrected as currently exporting `CtxLike` as `VoidCtxLike`
export type Evt<T> = import("./Evt.ts").Evt<T>;
...
We can confirm that it is the evt
module itself and not Opine through the simple example:
export { Evt } from "https://deno.land/x/evt@v1.9.11/mod.ts";
Which results in...
error: Uncaught SyntaxError: The requested module './CtxLike.ts' does not provide an export named 'CtxLike'
export { CtxLike } from "./CtxLike.ts";
~~~~~~~
at <anonymous> (<https://deno.land/x/evt@v1.9.11/lib/types/interfaces/index.ts>:5:1)
Would you mind a raising an issue on the https://github.com/garronej/evt repo for the maintainers to fix there?
I've opened an issue garronej/evt#17 BTW i have another question, have you tried to bundle opine? I'm getting an error like
error: Uncaught ReferenceError: Cannot access 'request2' before initialization
request2.get = function get(name) {
^
Sorry for the disturbance.
@lowray no need to apologise! π
Are you referring to deno bundle
or deno compile
? Either way do you mind opening a separate issue with the details so we track this different error there?
Thanks for raising the issue on the evt repo π
Thanks, @cmorten for doing the investigation work for me!
@cmorten @lowray DONE. I addressed the issue in v1.9.12 of EVT π.
I would do a PR to update the lock.json
but I don't know how you manage it and I am exhausted
Believe it or not, it took me like 5 hours to fix this.
Supporting both older version of typescript and Deno is getting more and more challenging. π
Nice one @garronej, youβre a βοΈ!
Gosh that does sounds exhausting π
Iβll get things sorted from this end
@garronej @cmorten i really appreciate it. thank you all β₯οΈ
Issue
Setup:
I'm getting an error while i disable ts check for my app
Details
command :
deno run -A --no-check serve.ts
output :code i use :