Skip to content

Renaming namespace with const enum doesn't update enum referencesΒ #61258

@xiaoxiyao

Description

@xiaoxiyao

πŸ”Ž Search Terms

"rename namespace const enum","const enum in namespace"

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about "enum"

⏯ Playground Link

https://www.typescriptlang.org/play/?#code/PTAECcFMDsEMFtKgC4AsCWBnUdGYA6wDGkAULpAcUspcqAN6miiQAe+A9uPUZ9JnowArvFABRRsxagAgqAC8oAOSxl0gL6ktpPgPqwAXCjoA6SUtqDzp2QG4gA

πŸ’» Code

// rename this namespace
namespace test {
  export const enum E {
    A = 'a'
  }
}

const a: test.E = test.E.A;

πŸ™ Actual behavior

Rename test to test1 via "Rename Symbol" or "F2".

// rename this namespace
namespace test1 {
  export const enum E {
    A = 'a'
  }
}

const a: test1.E = test.E.A; // this value remains unchanged

πŸ™‚ Expected behavior

// rename this namespace
namespace test1 {
  export const enum E {
    A = 'a'
  }
}

const a: test1.E = test1.E.A;

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions