Skip to content

export import of types is not allowed in namespaces when using erasableSyntaxOnlyΒ #61326

@phryneas

Description

@phryneas

πŸ”Ž Search Terms

export import alias type-only namespaces erasableSyntaxOnly

πŸ•— Version & Regression Information

  • I was unable to test this on prior versions because erasableSyntaxOnly was just released

⏯ Playground Link

https://www.typescriptlang.org/play/?erasableSyntaxOnly=true&ts=5.8.2#code/PTAEBcAsEsGdQO4HsBOBrWBYAUAOwIYC2AprAA74DGxEAnmaaAN46ijEAeZq4oAJsUoAbfChrh6NAGJIkbALygAjDgC+OHCFAAjAK68ocfklK4A5L2ToANKHxCoSXQHNIoaODPwJDALRJcIVpbcFkcAhJyKnFJWAB1D0gAJWJObhReFmw2NJ53QnTeABVQRR9GNQ1sLUN4IyQ0fFpwolIKalAAN3tdRiycrjzKANheADNZUuVK7Bxyuyny2AA6GSQ5yVAORdiEqBTcjOWi1dkgA

πŸ’» Code

// this works
namespace types {
  export declare type Foo  = 1
}

// but this doesn't work, although it's type-only, too
namespace typesWithReexport {
  export import T = types 
}

// ignoring the error, generally these should be both accessible
type a = types.Foo
type x = typesWithReexport.T.Foo

πŸ™ Actual behavior

export import re-exporting a namespace (or namespace member) of a type-only namespace from another type-only namespace results in This syntax is not allowed when 'erasableSyntaxOnly' is enabled.

πŸ™‚ Expected behavior

It should not error.

Additional information about the issue

@jakebailey asked me to open an issue to track this on bsky: https://bsky.app/profile/jakebailey.dev/post/3ljdc3ou7oc2w

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions