After using TS for more than a year, I still find myself facing confusion when it comes to importing and exporting. Why am I unable to spread an object I imported into the export object?
/// file1
export {
PORT,
SSL_CRT,
SSL_KEY,
}
// file2
import * as env from 'file1'
// env.PORT is accessible at this point
export {
...env // [ts] Identifier expected. [1003]
}
I manage to resolve this issue with the following workaround, although I understand it's not exactly what I want.
// file2
import * as env from 'file1'
export default {
...env // [ts] Identifier expected. [1003]
}