resolveJsonModule, const
Allow setting "resolveJsonModule": "const" as well as false and true.
as const is very useful, as is resolveJsonModule. I should be able to use them together.
I have some type helpers that can build strongly-typed dictionaries from some seed data whose schema is in another domain. We'd like to be able to use the json for things outside typescript, so would rather not put it in a .ts file. resolveJsonModule is almost what we need, but we can't import as const.
Assuming that seed data is defined like this:
const data = {
items: [{ id: 'alice', type: 'person' }, { id: 'bob', type: 'person' }, { id: 'fido', type: 'pet' }]
} as const
const testHelper = // ...lots of type magic, taking advantage of the types in `items` being {id: "alice", type: "person"} etc., not just {id: string; type: string}
testHelper.person.alice // {id: 'alice', type: 'person'}
My suggestion meets these guidelines:
Most helpful comment
https://github.com/microsoft/TypeScript/issues/32063