Typescript compatibility
Because this module extends functionality of Console, the following is required to avoid typescript complaining about missing "draft" function:
interface Console {
draft: (a) => (b) => {}
}
I think to support this from the module level, we can use the global declaration feature
declare global {
interface Console {
draft: (a) => (b) => {}
}
}
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 [email protected]
Running into issue @adelisle mentioned using
[email protected]
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') : () => {};
}