Skip to content

When an enum is imported and used only as a type with "verbatimModuleSyntax" enabled, an error is not being shownΒ #55741

Closed as not planned
@lsalazarm99

Description

@lsalazarm99

πŸ”Ž Search Terms

"verbatimModuleSyntax", "enum"

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about "verbatimModuleSyntax" (there wasn't any) and "enums".

⏯ Playground Link

https://www.typescriptlang.org/dev/bug-workbench/?verbatimModuleSyntax=true&ts=5.0.4#code/PTAEAEDcFMCcCMCGAXAlgWwLIHsAmBXAG2gGUBPAO2UQA8AuUZWfaAKFZAgDNViLF00Bj2IBaAO6pkAC1HQaAB2yxkAOmQBnVvKUrQ0CvnSgA6stwbQAb1ag7oAIKgAvKABEDtwBpb9gEIu7n7erAC+7DrKyIxkCtCm5oEaTKgUAOYA3Oyc4CIGAkKgqbjy6loYutFWCbAWXjW4oKGgXLDYxm6qwHkSUrKRKm7sxNGIDGa1WSOgiBRkE7jj5hoZQA

πŸ’» Code

// @verbatimModuleSyntax: true

// @filename: file-with-export.ts
export enum Words {
    A = "A",
    B = "B",
}

export type Word = string;

// @filename: index.ts
import { Words, Word } from "./file-with-export"

let a: Word;
let anyWord: Words;

πŸ™ Actual behavior

The import of the Words enum doesn't show any errors.

πŸ™‚ Expected behavior

The import of the Words enum should show a 1484 error.

Additional information about the issue

The mentioned import should show an error because it's being used only as a type and the "verbatimModuleSyntax" flag is enabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions