Tengo un archivo config.json:
{ "attribute": "value" }Cuando intento importarlo:
import data from './config.json' class Service1 { private config: Record<string, unknown> | undefined initConfig(data: Record<string, unknown>) { this.config = data return this.config } getAttribute(){ const {attribute} = this.initConfig(data) return attribute } } Obtuve el error tslint para la línea const {attribute} = this.initConfig(data) :
Argument of type '{}' is not assignable to parameter of type 'Record<string, unknown>'. Index signature for type 'string' is missing in type '{}'.¿Por qué TypeScript considera los datos como un objeto vacío?