Open UrielCh opened 2 years ago
I found an ugly solution:
export type * as Protocol from "./types/protocol.d.ts";
export { type Protocol } from "./lib/protocolModule.ts";
and add a file lib/protocolModule.ts
:
export * as Protocol from "../types/protocol.d.ts";
Is that the proper solution ?
After publishing this version, my types/*.d.ts
are not available in my nodejs version. I need to add an extra step to copy and convert d.ts file in the build.ts,.
Deno.mkdirSync("npm/types/types");
const files = Deno.readDirSync("types");
for (const file of files) {
if (!file.isFile)
continue;
let text = Deno.readTextFileSync(`types/${file.name}`)
text = text.replace(/.d.ts(["'])/g, "$1");
Deno.writeTextFileSync(`npm/types/types/${file.name}`, text);
}
Is there a proper call in dnt to copy and convert a d.ts file from deno to node (In my case removing all the d.ts at the end the import statement)
Hi,
I almost port ChromeDevToolsProtocol project to deno, I'm facing an last error.
Original version
My ChromeDevToolsProtocol api use to contains a big protocol.d.ts file like this:
exported in
mod.ts
with:full file
as mention in Deno FAQS
Fixed version
So to clean that, I replace all those namespace by modules
in protocol.d.ts :
exported in
mod.ts
with:full version
With that change my deno code works fine.
But once converted to nodeJS with dnt, this export is generated as a code export, event if it only contains interfaces. (I also replace interface by type) so it only contains type.
The dnt conversion end with an error:
The line causing the error in the generate node code is:
yep, the is no code for protocol, it's only a definition file.
To fix that I should replace:
export * as Protocol from "./types/protocol.d.ts";
by something like that:export type * as Protocol from "./types/protocol.d.ts";
but this syntax is not valid in Typescript.What did I do wrong ? how can I force this
export * as
to be a type.Thx for your time, deno is great.