Skip to content

Types not matching when use destructuring assignment, but the hint error is ignoredΒ #49761

Closed
@hxse

Description

@hxse

Bug Report

πŸ”Ž Search Terms

Types not matching destructuring assignment hint error ignored

πŸ•— Version & Regression Information

ts version: 4.6.4

⏯ Playground Link

https://www.typescriptlang.org/play?#code/C4TwDgpgBAhgKuaBeKBvWAuKA7ArgWwCMIAnKAXwFgAoAYwHtsBnYTWBSKFdGLARgBMAZgA0UQlgAsAVgBsFGg2asJ7RFzRtBoqADp96VTPnkF1IA

πŸ’» Code

type aType = { a: number }
const a: aType = { a: 123, b: 456 } // βœ… hint error 
const b: aType = { a: 123, ...{ b: 456 } }// ❌ not hint error, why?

πŸ™ Actual behavior

const a hint the error
const b not hint the error

πŸ™‚ Expected behavior

const a hint the error
const b hint the error too, beacuse aType don't match "{ b: 456 }"

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions