You're mixing up runtime with compile time. TS doesn't know in compile time that 'key1' exists. If you explicitly write const key1 = props['key1'] it will infer it as unknown, because you said that props[string] = unknown.

Comments