1π
β
I assuming that the @
is understood by your builder as the src folder and the file is found.
The error comes from TypeScript, because you import a .js file and TS does not know what types to expect from it.
I think your best two options are:
- Rename
src/env.js
tosrc/env.ts
β then it is a TypeScript file and TS will infer the types automatically - If, for some reason, you donβt want to rename the file, add a declaration file (
env.d.ts
), where you give the types for the module exports manually:
export default {
api_url: string,
api_key: string
}
π€Moritz Ringler
Source:stackexchange.com