Skip to content

Support for type destructuring #13135

Open
@shlomiassaf

Description

@shlomiassaf

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    In DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions