Error: Debug Failure at typeToString

雙木枯榮發表於2019-02-16

錯誤詳情如下:

ERROR in : Error: Debug Failure.
    at typeToString (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:28777:22)
    at reportRelationError (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:34714:34)
    at isRelatedTo (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:34860:21)
    at checkTypeRelatedTo (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:34697:26)
    at checkApplicableSignature (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:40608:26)
    at resolveCall (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:41011:17)
    at resolveCallExpression (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:41163:20)
    at resolveSignature (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:41398:28)
    at getResolvedSignature (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:41430:26)
    at checkCallExpression (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:41479:29)
    at checkExpressionWorker (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:42950:28)
    at checkExpression (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:42898:42)
    at checkExpressionStatement (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:44962:13)
    at checkSourceElement (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:46746:28)
    at Object.forEach (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:1506:30)
    at checkBlock (F:workangularweb-ide
ode_modules	ypescriptlib	ypescript.js:44563:16)
    
    

我程式碼裡出現這個錯誤的原因是 在定義Map的時候,值為陣列型別,但未給陣列賦值泛型,如下:

  public renderStateMap = new Map<string, []>();

解決方案

只需要給陣列新增型別即可:

  public renderStateMap = new Map<string, any[]>();

相關文章