turbulenz / turbulenz_engine

Turbulenz is a modular 3D and 2D game framework for making HTML5 powered games for browsers, desktops and mobile devices.

Home Page:http://turbulenz.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Typescript compiler errors on ellipses

MisterTea opened this issue · comments

I'm not sure if these errors are fatal or not, but I'm getting a lot of errors of this form:

../jslib-modular/capturedevices.d.ts:53:32: error: '...' parameters require both a parameter name and an array type annotation to be specified

It looks like it continues to try to build, so feel free to mark this WORKSASINTENDED if it's ok.

Thanks for the report. This needs fixing, or rather working around, on our end.
The TypeScript compiler appears to not output the appropriate type information to the .d.ts file for variable numbers of args, i.e. the (... args: any[]) notation.

Already fired an issue in CodePlex :)
https://typescript.codeplex.com/workitem/1006

Thanks for the link. That's good news.

I think we'll have to work around it for now anyway. There is also an issue where (...) generates unnecessary code in the .js output, so we may decide to avoid using it anyway.

@dtebbs upvoted.

But I am not sure it's unnecessary, check this: http://jsperf.com/arguments-slice-vs-for/2
Looks like looping works better than slicing.

Thanks.

Actually, I was just hoping for a way to make a function that that takes a variable number of args and accesses 'arguments' directly. Currently the only way is to write (a0?, a1?, a2?, ) long enough to cover all cases. I'll post an update to make it clearer.

We removed the use of variadic arguments on commit 2d076d2, if you pull again the code it should be fine now.

Looks good, thanks!