Skip to content

TS fails to detect lost this binding #60235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Rudxain opened this issue Oct 15, 2024 · 2 comments
Closed

TS fails to detect lost this binding #60235

Rudxain opened this issue Oct 15, 2024 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@Rudxain
Copy link

Rudxain commented Oct 15, 2024

πŸ”Ž Search Terms

context TypeError Cannot convert undefined or null to object noImplicitThis disambiguator

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about this

⏯ Playground Link

https://www.typescriptlang.org/play/?target=99&jsx=0&ts=5.7.0-dev.20241015#code/PTAEDMEsDsFMCgAUBtAugOgM4HsBOAXASkUIG54kBGUAMhtDSzyJPJFAFVoBjAQwFcA5gAt8oACoBPAA6wAorlx4AXKADCvaNGxju2aADdYBUP2gATWFDjnQeUNH4AbJ6HzY7AIwBWsbvnh2UGDeMRwTRAAeTX1JAFtsfkwAPkIKJ1gw0ABeBgxw-HJMVkCwLj4hUQkZeUUVdU1tXX0jEzNLa1hbe0cXNw9sHz8AoJCw5lAomOh4xJTCIA

πŸ’» Code

// fine
([].sort)();

(1 && [].sort)();
// Uncaught TypeError: Cannot convert undefined or null to object
//    at sort (<anonymous>)

let s = [].sort;
s();
// Uncaught TypeError: Cannot convert undefined or null to object
//    at sort (<anonymous>)

πŸ™ Actual behavior

Run-time error

πŸ™‚ Expected behavior

Compile-time error

Additional information about the issue

mdn/content#36355

@jcalz
Copy link
Contributor

jcalz commented Oct 15, 2024

duplicate #7968

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Oct 16, 2024
@typescript-bot
Copy link
Collaborator

This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants