You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constarr=[3,1,4,1,5,9,2]constobj=Object.groupBy(arr,(e)=>e%2===0 ? "even" : "odd");obj.toString()// The compiler allows this. However, the browser throws an error.obj?.toString()// This still gives the browser an error.
π Actual behavior
The value returned by "Object.groupBy" is an object with null as prototype and does not have toString(). However, TypeScript compilers allow this.
π Expected behavior
If a non-existent method such as toString is used in the value returned by "Object.groupBy", the compiler will detect it.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
π Search Terms
Object.groupBy
π Version & Regression Information
I tried with
5.2.2
and5.6.0-dev.20240705
To see what is happening, you need to add "esnext" to lib.
β― Playground Link
https://www.typescriptlang.org/ja/play/?ts=5.6.0-dev.20240705#code/MYewdgzgLgBAhgJwTAvDA2gZgDQwIy4AsuBMArLgJy4BMAugFCiSwgBGAVqjAPKcCmwKADoA5ghABXAA4AhAJ4AKRAlyL+ASlQA+GPxgBSGDVQo0ABhgB+GACJ+AN35hbMAFx2QAEy+2NAbgZ2DmEoEABlKAQASzBRRS0AekSYABUAC31QAFtpaIAbfmQ4fPyQAHcIGCh06IhhGAAJCsci3Br9NglKour07qq4MD0kEARhIM4rUIio2PiklIy6mGgC-JhRaKcqjpguioheoZGJcaA
π» Code
π Actual behavior
The value returned by "Object.groupBy" is an object with null as prototype and does not have toString(). However, TypeScript compilers allow this.
π Expected behavior
If a non-existent method such as toString is used in the value returned by "Object.groupBy", the compiler will detect it.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: