tsc gives 'Duplicate identifier' error messages (@openui5/[email protected])

Open
#289 12 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
tooling

Research direction

Reproduce the report with the shown tsconfig.json, empty.js, TypeScript 4.3.5, and @openui5/[email protected]. Inspect the duplicate declarations in types/sap.m.d.ts, types/sap.ui.commons.d.ts, and types/sap.ui.core.d.ts, then compare how the configured type libraries are loaded. Done means the minimal tsc run no longer reports these duplicate identifier errors.

Written by the indexing model from the issue text.

Description

legacy ts-types (with globals)

When running tsc on an empty JavaScript file it gives the following error messages:

$ ./node_modules/typescript/bin/tsc
node_modules/@openui5/ts-types/types/sap.m.d.ts:301:15 - error TS2300: Duplicate identifier 'MessageBox'.

301     namespace MessageBox {
                  ~~~~~~~~~~

node_modules/@openui5/ts-types/types/sap.m.d.ts:24179:15 - error TS2300: Duplicate identifier 'MessageBox'.

24179     interface MessageBox {
                    ~~~~~~~~~~

node_modules/@openui5/ts-types/types/sap.m.d.ts:24868:11 - error TS2300: Duplicate identifier 'MessageBox'.

24868     const MessageBox: MessageBox;
                ~~~~~~~~~~

node_modules/@openui5/ts-types/types/sap.ui.commons.d.ts:3401:17 - error TS2300: Duplicate identifier 'MessageBox'.

3401       namespace MessageBox {
                     ~~~~~~~~~~

node_modules/@openui5/ts-types/types/sap.ui.commons.d.ts:6401:17 - error TS2300: Duplicate identifier 'MessageBox'.

6401       interface MessageBox {
                     ~~~~~~~~~~

node_modules/@openui5/ts-types/types/sap.ui.commons.d.ts:6526:13 - error TS2300: Duplicate identifier 'MessageBox'.

6526       const MessageBox: MessageBox;
                 ~~~~~~~~~~

node_modules/@openui5/ts-types/types/sap.ui.core.d.ts:37617:19 - error TS2300: Duplicate identifier 'odata4analytics'.

37617         namespace odata4analytics {
                        ~~~~~~~~~~~~~~~

node_modules/@openui5/ts-types/types/sap.ui.core.d.ts:39118:19 - error TS2300: Duplicate identifier 'odata4analytics'.

39118         interface odata4analytics {
                        ~~~~~~~~~~~~~~~

node_modules/@openui5/ts-types/types/sap.ui.core.d.ts:39133:15 - error TS2300: Duplicate identifier 'odata4analytics'.

39133         const odata4analytics: odata4analytics;
                    ~~~~~~~~~~~~~~~

node_modules/@openui5/ts-types/types/sap.ui.core.d.ts:58425:15 - error TS2300: Duplicate identifier 'Device'.

58425     namespace Device {
                    ~~~~~~

node_modules/@openui5/ts-types/types/sap.ui.core.d.ts:59682:19 - error TS2300: Duplicate identifier 'dataTableUtils'.

59682         namespace dataTableUtils {
                        ~~~~~~~~~~~~~~

node_modules/@openui5/ts-types/types/sap.ui.core.d.ts:59750:19 - error TS2300: Duplicate identifier 'dataTableUtils'.

59750         interface dataTableUtils {
                        ~~~~~~~~~~~~~~

node_modules/@openui5/ts-types/types/sap.ui.core.d.ts:59826:15 - error TS2300: Duplicate identifier 'dataTableUtils'.

59826         const dataTableUtils: dataTableUtils;
                    ~~~~~~~~~~~~~~

node_modules/@openui5/ts-types/types/sap.ui.core.d.ts:63827:15 - error TS2300: Duplicate identifier 'Device'.

63827     interface Device {}
                    ~~~~~~

node_modules/@openui5/ts-types/types/sap.ui.core.d.ts:63828:11 - error TS2300: Duplicate identifier 'Device'.

63828     const Device: Device;
                ~~~~~~


Found 15 errors.

$ cat tsconfig.json
{
	"compilerOptions": {
		"incremental": true,
		"noImplicitAny": false,
		"noImplicitReturns": true,
		"noImplicitThis": true,
		"strictBindCallApply": true,
		"strictFunctionTypes": true,
		"strictPropertyInitialization": false,
		"strictNullChecks": false,
		"allowJs": true,
		"checkJs": true,
		"module": "ESNext",
		"target": "ES2020",
		"types": ["@openui5/ts-types", "@types/qunit", "@types/jquery"],
		"noEmit": true,
		"noFallthroughCasesInSwitch": true, 
		"allowUnreachableCode": false,
		"allowUnusedLabels": false,
		"lib": ["dom","es7"]
	},
	"include": [
		"./empty.js"
	]
}
$ npm list
[email protected] /Users/myuser/Documents/my_fiori
├── @openui5/[email protected]
├─┬ @types/[email protected]
│ └── @types/[email protected]
├── @types/[email protected]
└── [email protected]


Dominant language
TypeScript
Stars
213
Forks
35
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from UI5/typescript

All issues in UI5/typescript

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.