Skip to content

Incorrect namespace error when generating declarations #24632

Closed
@WearyMonkey

Description

@WearyMonkey

TypeScript Version: 3.0.0-dev.20180602

Search Terms:

Cannot find namespace, declaration, TS2503

Code

yarn add typescript@next
yarn tsc -- src/foo.ts --declaration
const Foo = {
  BANANA: 'banana' as 'banana',
}

export const Baa = {
  [Foo.BANANA]: 1
};

Expected behavior:

No error.

Actual behavior:

src/foo.ts:6:4 - error TS2503: Cannot find namespace 'Foo'.

6   [Foo.BANANA]: 1
     ~~~


error Command failed with exit code 2.

Omitting the --declaration option results in no error.
Ommiting the cast results in no error.

Playground Link:

Related Issues:

#24432

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts files

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions