Last active
January 5, 2022 22:18
-
-
Save onosendi/daac1419fb56eb58ab8e1e555972cf40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const foo = [ | |
{ key: 'one' }, | |
{ key: 'two' }, | |
]; | |
const bar = { | |
one: 'one', | |
two: 'two', | |
}; | |
foo.forEach((item) => { | |
// Element implicitly has an 'any' type because expression of type | |
// 'string' can't be used to index type '{ one: string; two: string; }'. | |
// No index signature with a parameter of type 'string' was found one | |
// type '{ one: string; two: string }' | |
console.log(bar[item.key]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment