Strange error: string is not a string type
See original GitHub issueTypeScript Version: 4.1.2
Search Terms: downlevelIteration, string, spread
Code
function test(name: string) {
for (const _char of [...name]) {
}
}
Run tsc on just this ts file with no extra flags (I couldn’t find the right combination of playground checkboxes to simulate this.
Expected behavior: Assuming the code is wrong, the error message should probably not say that string is not a string type.
Actual behavior:
error TS2569: Type 'string' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of
iterators.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
TS Error: Type 'string' is not an array type or a ... - Stack Overflow
Show activity on this post. TS throws strange error: Error:(125, 18) TS2569: Type 'string' is not an array type or a string type....
Read more >Fix C++ Error: String is Undefined - Linux Hint
Undefined string in C++ programming refers to when a program fails to compile, when it executes wrong, crashes or produces inaccurate results, or...
Read more >ERR34-C. Detect errors when converting a string to a number
The string might not contain a number. It might contain a number of the correct type that is out of range (such as...
Read more >Panic column:string is not type of time
Yet I get a strange error: Error: panic: column create_datetime:string is not of type time. I didn't even get to the to() part....
Read more >Strange "TypeError: string indices must be integers" when ...
Algorithm parameters should be a dictionary object not a string object. When you pass your procString variable, you are giving the parameters ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@RyanCavanaugh 4.1.2 (as in the description 😛)
Please guide me a little bit as this is my first PR. Thanks!
https://github.com/microsoft/TypeScript/pull/41948