Cook
Object where keys are integers as string
interface IDictionary<TValue> {
[id: string]: TValue;
}
// later
const myObject: IDictionary<string> = { "0": "teleport" }
Object where keys are not known ahead of time
const constants: Record<string, any> = {}
constants.dendronTechUrl = 'https://tycholiz.github.io/Digital-Garden/'
export default constants
Create a type that can evaluate to a certain interface, or a function that returns that same interface
Here, initValueType
will accept as T
either a type or function that returns that type
type initValueType<T> = T | (() => T)
// and use like:
initValueType<Response>