externs for threejs

118 views
Skip to first unread message

Atul Kumar

unread,
Nov 23, 2015, 7:43:24 AM11/23/15
to Haxe
Hello,

are there any up to date externs for threejs?

I only found https://github.com/labe-me/haxe-three.js/tree/master but this is only for version 57. And most recent threejs version is at 73.

Haxiomic

unread,
Nov 23, 2015, 8:42:41 AM11/23/15
to Haxe
Hey Atul, I've just pushed up some three.js externs generated from the latest DefinitelyTyped definitions which are currently at r73


The generator itself isn't ready to release but that repo should have the latest externs within a day or so of changes to the typescript

Atul Kumar

unread,
Nov 23, 2015, 11:43:13 AM11/23/15
to Haxe
Cool. Thank you very much!

Yaroslav Sivakov

unread,
Nov 25, 2015, 6:46:24 AM11/25/15
to Haxe
https://bitbucket.org/yar3333/haxe-threejs/ - not recent treejs version, but it is simple to upgrade (generator included)

понедельник, 23 ноября 2015 г., 15:43:24 UTC+3 пользователь Atul Kumar написал:

David Mouton

unread,
Nov 26, 2015, 3:59:26 AM11/26/15
to Haxe
If you get an updated version, tell me, i'll update the npm's one

Atul Kumar

unread,
Nov 27, 2015, 8:52:37 AM11/27/15
to Haxe
Thank guys..

I used haxiomic ones for now. They work well.

I guess there they are not related to Yaroslave one? Both are automatically generated from typescript though? But the generators are also different ones?

Actually I am also very interested in this generators. There are other .d.ts files from which I would like to have externs from: https://github.com/Microsoft/vscode-extension-vscode

I there are generator which could work with those?

@Yaroslav: If I understand it right if i would like to use refactor for that I would have to write some kind of regex rules first, right?

@Haximoic: I guess your generator is still private than? Will it be open source? Do u plan to release it soon?

I might make another post in the group about generating externs from .d.ts since it is off topic of this thread.


Cheers

Yaroslav Sivakov

unread,
Nov 27, 2015, 9:13:06 AM11/27/15
to Haxe
In common: yes. If you want to convert TypeScript => Haxe, you may just use regexs from my treejs generator. You must only fix rules for "hard" places (for example, TypeScript do not distinct Int and Float types, so if you want to have Int in Haxe, you would to do some work).

пятница, 27 ноября 2015 г., 16:52:37 UTC+3 пользователь Atul Kumar написал:

Haxiomic

unread,
Nov 27, 2015, 9:16:37 AM11/27/15
to Haxe
Hey Atul,

The generator I'm using it's a fork from Sims typescript converter https://github.com/Simn/ts2hx with a heap of rules added to account for all the special cases and oddities of d.ts files 

The lofty goal I'm aiming for is completely autonomous conversion from typescript. Works well for a lot of the d.ts files in DefinitelyTyped but there are a few more cases that need handling

It's separate from Yaroslav's, but his works well nevertheless and a benfit of his approach is the hx externs retain comments

I took a stab at converting vscode.d.ts, looks like it relies on a bunch of ES6 and nodejs types which is a pain (the converter I'm working on has so far has been designed for browser based js)

From a glance the externs wont work straight away, but they could be a good place to start

Atul Kumar

unread,
Nov 27, 2015, 9:53:20 AM11/27/15
to Haxe
Thanks a lot guys. That is very helpful.

Seems like both approaches involve quite a lot of handy work, though.

Advantage in working on the rules for refactor is that it is a one time thing. So when vscode is updated I can just fire it up and I get fresh new externs.

Nevertheless I might go the route of working with your files @haxiomic. I am not sure. I have a look this weekend. Thanks for the zip. I had a quick look. Seems very helpful. Even though I would prefer it if it could be just one .hx file. Also Import statemets seems not being generated, right?

Haxiomic

unread,
Nov 27, 2015, 10:23:18 AM11/27/15
to Haxe
Yeah, in the case of that t.ds file the import statements aren't generated (they're usually generated for others but that's one of the issues I need to fix before releasing :P). In principle, once the ES6 and node types also have externs we should be able to automatically port any node.js d.ts without any effort.

For one hx file I guess you could cat the externs recursively then just find remove all the package statements except for the first

If you've got a bash shell you could do something like

find vscode/ -name '*.hx' -exec cat {} \; > Vscode.hx

to concat your files recursively, then you just need to find/replace for your package statements
Reply all
Reply to author
Forward
0 new messages