spite / THREE.MeshLine

Mesh replacement for THREE.Line
MIT License
2.18k stars 380 forks source link

TypeScript Support #75

Closed PhilippCh closed 5 years ago

PhilippCh commented 5 years ago

Hi there,

do you plan on supporting TypeScript anytime soon? I'd love to use the library in an Angular 7 project, but AFAIK that's not possible at the moment.

Cheers Philipp

kdiudenko commented 5 years ago

I am able to use it with webpack imports-loader workaround in Angular 6 project:

import * as THREE from 'three';
import 'imports-loader?THREE=three,exports=>undefined,this=>THREE!three.meshline/src/THREE.MeshLine';

const material = new (THREE as any).MeshLineMaterial();
const line = new (THREE as any).MeshLine();
ACMCMC commented 4 years ago

I would really like native TypeScript support as a feature! Are there any plans to implement that?

Jeremboo commented 4 years ago

I'll consider that for the next version! Thanks for your comment

AlexVestin commented 4 years ago

I did a typescript port at https://github.com/AlexVestin/THREE.MeshLine/blob/master/src/THREE.MeshLine.ts if that is of any use. I haven't really tested it thoroughly (and I left some comments marked TODO where I wasn't sure of the right implementation), but it's working for my use-case.

davemus commented 4 years ago

The result of many hours of research to quickly get it running, while writing only 1 line. Write the ambient type declaration

In my case I have file typings.d.ts in my Angular project and write there next line:

declare module 'three.meshline';

And import all like this:

import { MeshLine, MeshLineMaterial } from 'three.meshline'

Hope it would be helpfull!