Skip to content

Duplicate identifier 'Node', how to let Typescript know my file is a module #7990

@carlosdubus

Description

@carlosdubus

I'm building a module and I want to name a class 'Node'. Looks like 'Node' already exists in the global scope. A module file has an isolated scope, so it will not replace the global 'Node' class. How can I tell typescript that a file is a module so it does not complain about duplicates?

models.ts:
class Node {}

If I add export to the Node class, the warning is gone.

tsc --version
Version 1.8.9

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