Tag Archives: TS

[Solved] TS error: element implicitly has the type ‘any’ because the type of the index expression is not ‘number’‘

preface

When developing my gift package for VIP requirements, I encountered a TS error reporting element that implicitly has the type of “any”, because the type of index expression is not ‘number’‘

Solution:

1. The wrong wording is:

window["CESIUM_BASE_URL"]="src/assets/cesium"

2. The correct wording is:

(window as any).CESIUM_BASE_URL = 'src/assets/cesium/';

[Solved] Property or signature expected when compiling TS

report errors:

error TS1131: Property or signature expected.

reason

The reason is that get is used in the TS interface and node_Modules are placed outside the package project and TSC – P is used   Tsconfig.json compilation. Using TSC compilation alone does not have this problem

The solution is to choose one from the other

1. Set node_Modules install one in the package project

2. Install typescript globally