We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Simple interface doesn't extends Record<string, unknown>
We can't use extends object because it's for any JS object, it's not good
extends object
Interface extends Record unknown
This is the behavior in every version I tried, and I reviewed the FAQ for entries
https://www.typescriptlang.org/play?#code/C4TwDgpgBAsg9gNwgFXNAvFA3lAHgLigDsBXAWwCMIAnAGihENMpqgF8AoASyOBoDMAhgGNo8JAEleAkdBwFi5KnQZMlrTh2FwiAZ2BQuugBoBNKJgAUgwgCUI26gBMAPPuo8A5vRJEA1kRwAO5EAHwAlISChrrYeGosKoyKiewWodgcUFDUEMAk1ERQwNQkEByaADZ5xYTiKGgWcQoADPTJLewc1QZcdYgQUnzUQqJN8oRtqlCdmkZmlsDh3CamllzLQA
type MoveType = { x: number, y: number } interface MoveInterface { x: number, y: number } const isXY = (a: Record<string, unknown>): a is { x: number, y: number } => { return true } let t: MoveType = { x: 0, y: 0 } let i: MoveInterface = { x: 0, y: 0 } isXY(t) isXY(i)
We can use isXY for the type, not for the interface
type
interface
Can use isXY(i)
isXY(i)
The text was updated successfully, but these errors were encountered:
Duplicate of #42825. This is working as intended.
Sorry, something went wrong.
Thanks @MartinJohns I tried to check if this error was known and didn't found this issue, I'm closing this one
No branches or pull requests
Bug Report
Simple interface doesn't extends Record<string, unknown>
We can't use
extends object
because it's for any JS object, it's not good🔎 Search Terms
Interface extends Record unknown
🕗 Version & Regression Information
This is the behavior in every version I tried, and I reviewed the FAQ for entries
⏯ Playground Link
https://www.typescriptlang.org/play?#code/C4TwDgpgBAsg9gNwgFXNAvFA3lAHgLigDsBXAWwCMIAnAGihENMpqgF8AoASyOBoDMAhgGNo8JAEleAkdBwFi5KnQZMlrTh2FwiAZ2BQuugBoBNKJgAUgwgCUI26gBMAPPuo8A5vRJEA1kRwAO5EAHwAlISChrrYeGosKoyKiewWodgcUFDUEMAk1ERQwNQkEByaADZ5xYTiKGgWcQoADPTJLewc1QZcdYgQUnzUQqJN8oRtqlCdmkZmlsDh3CamllzLQA
💻 Code
🙁 Actual behavior
We can use isXY for the
type
, not for theinterface
🙂 Expected behavior
Can use
isXY(i)
The text was updated successfully, but these errors were encountered: