Open ilyasfoo opened 5 years ago
good idea, can you make a merge request?
interface Console {
draft: (...args) => (b) => {}
}
Works for me as I leverage the console ...args
setup
Is there any progress on this?
I'm having an issue building a typescript project containing the recently published version 1.0.13 containing the merged #8.
node_modules/draftlog/index.d.ts:15:5 - error TS1038: A 'declare' modifier cannot be used in an already ambient context.
15 declare function into(console: Console, extra?: boolean): LineCountStream;
~~~~~~~
Found 1 error.
Removing that superfluous declare
fixes this issue.
tested draftlog 1.0.13 with rollup / rollup-plugin-typescript2. I have no problems and everything works perfectly regarding typescript compatibility.
Running into issue @adelisle mentioned using typescript@4.5.5
Running into issue @adelisle mentioned using
typescript@4.5.5
I wrapped the call with something like this and it works
const logUpdate = (msg: string): void => {
return 'draft' in console && typeof console.draft === 'function' ? console.draft('test') : () => {};
}
Because this module extends functionality of Console, the following is required to avoid typescript complaining about missing "draft" function:
I think to support this from the module level, we can use the global declaration feature