For our app at work, I want to encourage people to use a wrapper around localStorage
that automatically converts to/from JSON (and also has type-checking in place). I tried to override the global TS definition for window.localStorage:
declare global {
interface Window {
localStorage: null,
}
}
but that didn't really do anything - is there a way to prevent the use of window.localStorage from compiling and even better giving the user a useful warning about why it doesn't compile?
say if you just put the
interface Window {
localStorage: null,
}
in the declaration file that is global, and put that file in some place in your project that the TSC compiler (VS Code linter) knows about, then you would not even need that import './our-defs.d.ts'