Tag Archives: ‘number‘

[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/';