enabled is const and cannot be assigned.
ws93 opened this issue · 3 comments
Try to disable color mode in my Typescript code.
import * as colors from "ansi-colors"; colors.enabled = false;
It pops up this error
[ts] Cannot assign to 'enabled' because it is a constant or a read-only property.
Is that because TypeScript is seeing this definition?
If so, could you try removing the const
to see if that works? Would you also be able to do a PR to update any other types that should be able to be set?
Thanks for finding this and opening an issue.
Yes, I think that's because TS checks index.d.ts
file under types
folder and found enabled
is const.
Will submit PR after work.
For some odd reason I'm still having this problem with latest version. I can see the variable being export let ...
and not const, I don't know why TS 4.9.5 doesnt like. Anyway, @ts-ignore
to the rescue!