Skip to content

Cannot destructure properties of a resource obtained using the 'using' keywordΒ #55527

Description

πŸ”Ž Search Terms

using destructure

πŸ•— Version & Regression Information

  • I was unable to test this on prior versions because this is a new feature in 5.2

⏯ Playground Link

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

πŸ’» Code

functiongetResource(){return{foo: "bar",[Symbol.dispose]: ()=>{},}}{
using { foo }=getResource();console.log(foo);}```### πŸ™ Actual behavior> Error: 'using' declarations may not have binding patterns.(1492)### πŸ™‚ Expected behaviorShould be able to destructure a variable defined using the `using` keyword
### Additionalinformationabouttheissue_Noresponse_

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions