🔎 Search Terms
is:issue set difference does not exist
🕗 Version & Regression Information
I tested this on the Nightly TypeScript version, 5.7, 5.6, etc.
This is the behavior in every version I tried, and I reviewed the FAQ for entries about FAQ (For Issue Filers)
⏯ Playground Link
https://www.typescriptlang.org/play/?ts=5.7.0-dev.20240919#code/PTAEAsBdIBwZwFwgCYFMBuqA2B7GqAnAOgFscAvASyywEMicCBzYVAOwFoBVAZWGRwBjOMADqqAEbAAUrXS0eggpRiRgAJVQAzQu0GpgAcVwTaWAPoB5CQCtUgyCJ6o1ySlp0E9qACQAGAChBHDY4SFAcZGQ4UABeUDZUAHdQZ0gACgBtAEYAGlAAZnyAVnyAdnyATgBdAEoAbiCQsNA4AEcAV1ovGPjElLSsvNAAFiq6xuDQnCxUIlwmdMjoojcPXTZ9dPauntqG0BBUl3SC2tAAb0KS8tAAXyA
💻 Code
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/difference$0
const odds = new Set ( [ 1 , 3 , 5 , 7 , 9 ] ) ;
const squares = new Set ( [ 1 , 4 , 9 ] ) ;
console . log ( odds . difference ( squares ) ) ; // Set(3) { 3, 5, 7 }
🙁 Actual behavior
Property 'difference' does not exist on type 'Set<number>' . ts ( 2339 )
TypeScript does not recognize the property.
🙂 Expected behavior
I expected TypeScript to recognize the property, since:
MDN confirms it is widely available
Add types for stage 3 "set methods" proposal #57228 and add types for set methods proposal #57230 seem to have accepted and merged this back in May.
Why is the compiler still showing that it isn't recognized?
Additional information about the issue
No response
🔎 Search Terms
is:issue set difference does not exist
🕗 Version & Regression Information
I tested this on the Nightly TypeScript version, 5.7, 5.6, etc.
FAQ (For Issue Filers)⏯ Playground Link
https://www.typescriptlang.org/play/?ts=5.7.0-dev.20240919#code/PTAEAsBdIBwZwFwgCYFMBuqA2B7GqAnAOgFscAvASyywEMicCBzYVAOwFoBVAZWGRwBjOMADqqAEbAAUrXS0eggpRiRgAJVQAzQu0GpgAcVwTaWAPoB5CQCtUgyCJ6o1ySlp0E9qACQAGAChBHDY4SFAcZGQ4UABeUDZUAHdQZ0gACgBtAEYAGlAAZnyAVnyAdnyATgBdAEoAbiCQsNA4AEcAV1ovGPjElLSsvNAAFiq6xuDQnCxUIlwmdMjoojcPXTZ9dPauntqG0BBUl3SC2tAAb0KS8tAAXyA
💻 Code
🙁 Actual behavior
TypeScript does not recognize the property.
🙂 Expected behavior
I expected TypeScript to recognize the property, since:
Why is the compiler still showing that it isn't recognized?
Additional information about the issue
No response