Last active
April 10, 2020 14:37
-
-
Save mattbajorek/65782de8f848fe0834b54f8e3eeda894 to your computer and use it in GitHub Desktop.
TypeScript no generics example
This file contains hidden or 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
Object.values(groupedNumberData).forEach(numberArray => { | |
numberArray.forEach(num => { | |
// This won't work without a type assert or type check | |
console.log((num as number) * 2); | |
}); | |
}); | |
Object.values(groupedStringData).forEach(stringArray => { | |
stringArray.forEach(str => { | |
// This won't work without a type assert or type check | |
console.log((str as string).length); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment