We start to use typescript with wechat mini program development. There is this annoying yet harmless error when we compile the project:

The project would still run, but because the quirk of wechat mini program/typescript, this error would persist. I tried using eslint-disable-line or eslint-disable with no effect...
Here is how to test/simulate it:
In file a:
const App = () => {};
const Page = () => {};
const wx = {}, _wx = { App, Page };
module.exports = {
wx: { ...wx, ..._wx },
App: _wx.App,
Page: _wx.Page
}
Note, here we can't use:
export {
wx: { ...wx, ..._wx },
App: _wx.App,
Page: _wx.Page
}
because it is grammatically incorrect and we are not allowed to modify
const App = () => {};
const Page = () => {};
const wx = {}, _wx = { App, Page };
(imagine they are injected code instead of codes you actually write)
and in file b, you have:
import { wx, App, Page } from 'file_a'
import ... from '...'
Note import { wx, App, Page } from 'file_a' must be on the top.
Adding // @ts-ignore on top of import { wx, App, Page } from 'file_a'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With