focus-creative-games / luban

luban是一个强大、易用、优雅、稳定的游戏配置解决方案。luban is a powerful, easy-to-use, elegant and stable game configuration solution.
https://code-philosophy.com/
MIT License
3.4k stars 538 forks source link

[fix] typescript template #131

Closed neko1990 closed 6 months ago

neko1990 commented 6 months ago

修几个ts模板和语法的问题:

  1. commit 88c09b 引入两个 + 模板报错:
    
    ret 'for (let _e of ' + 'this.' + + fieldName + ') { _e?.resolve(tables); }'

|ERROR|===> "One or more errors occurred. ((44,49) : error : Unexpected value keys / Type: string. Cannot negate(-)/positive(+) a non-numeric value)" |ERROR|===> "(44,49) : error : Unexpected value keys / Type: string. Cannot negate(-)/positive(+) a non-numeric value" |ERROR|run failed!!!

2. 最初这段末尾少一个 `+` 模板报错 [commit 3d1fae](https://github.com/focus-creative-games/luban/commit/3d1faed5deb02035ce5c4d281a71b3e24f6d739f)  

ret 'foreach (var [_, _e] of ' + fieldName ') { _e?.resolve(tables); }'

|ERROR|===> "One or more errors occurred. ((46,52) : error : Invalid target function multiRows4 (string))" |ERROR|===> "(46,52) : error : Invalid target function multiRows4 (string)" |ERROR|run failed!!!


3. typescript 没有 foreach 关键字,对 map 的迭代也用 for
4. 用 let 替换 var,减小scope