I have an array in a .js file and I want to use it as a tuple in a .ts file. It's a .js file because it's used by config files such as webpack.config.js. Is it possible to import it as a tuple?
E.g.:
entityTypes.js:
export default ['foo', 'bar'];
main.ts:
import type entityTypes from 'entityTypes';
typeof entityTypes[number]; // if `entityTypes` is a tuple, this would be 'foo' | 'bar'
*.d.tsfile for yourentityTypes.jsfile?entityTypesis a tuple, this would be'foo' | 'bar'" - sounds like you want to usekeyof- but I'm not sure how that would work with a[ string, string ].entityTypesas an object and exportObject.keys(entityTypes). Then, in TS, I can dokeyof typeof entityTypes