When importing JSON files in TypeScript, the compiler infers types automatically via `resolveJsonModule`, but the inferred types can be overly specific. For example, a dictionary with string keys gets typed with literal property names rather than `Record<string, string>`. The solution is to use the `allowArbitraryExtensions` compiler option and create a `.d.json.ts` declaration file with the same base name as the JSON file, allowing you to define your own types. This overrides the compiler's inferred types, but requires you to ensure the JSON data actually matches your declared types to avoid runtime errors.
4 Impressions