microsoft / microsoft/TypeScript
Support for type destructuring
Open
Nobody has claimed this yet.
In Discussion
Suggestion
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 2.1.4
Code
import { MyNamespace } from 'my-package';
// importing Class objects:
const { NavLink, NavGroup } = MyNamespace; // VALID
// if we want the types as well:
type { NavLink, NavGroup } = MyNamespace; // NOT VALID
// So we have to go manual:
type NavLink = MyNamespace.NavLink; // VALID
type NavGroup = MyNamespace.NavLink; // VALID
Expected behavior:
Being able to use destructuring for types same as we use for objects.
Actual behavior:
Can only use destructuring for objects.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue provides no repository file, test, or entry point to begin from. Start by reproducing the TypeScript 2.1.4 example and then trace how object destructuring and type aliases are parsed and checked. Done means type destructuring works for the shown namespace example with appropriate compiler coverage and no regression to object destructuring.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100