import/extensions rule cannot be used in TypeScript
If you add .ts to it, TypeScript will complain that it is not valid
If you add .js to it, the rule complains that you shouldn't be using .js :/
as const cast in consts makes the object have those properties strictly typed (instead of it being a Record<string, string>)
Reflect.deleteProperty is the functional form of delete, just like Reflect.has is to the in operator. I use it instead of delete to skip TypeScript's complaining about the key not being able to index the object that's passed in
Notes:
import/extensions
rule cannot be used in TypeScript.ts
to it, TypeScript will complain that it is not valid.js
to it, the rule complains that you shouldn't be using.js
:/as const
cast in consts makes the object have those properties strictly typed (instead of it being aRecord<string, string>
)Reflect.deleteProperty
is the functional form ofdelete
, just likeReflect.has
is to thein
operator. I use it instead ofdelete
to skip TypeScript's complaining about the key not being able to index the object that's passed in