TS: Vector3 interface not descriptive enough to support this valid usage
See original GitHub issueDescription of the problem
The following code works, but TypeScript does not compile with the present Vector3.d.ts
// vector between center of head and center of ear
const earVector = new THREE.Vector3(1.44, 0.6, -0.3);
const leftEar = new THREE.SphereGeometry(1, 32, 32).applyMatrix4(new THREE.Matrix4().makeScale(0.4, 0.4, 0.25));
const rightEar = leftEar.clone();
leftEar.translate(...earVector.toArray());
earVector.x = -earVector.x;
rightEar.translate(...earVector.toArray());
BUG (compile error):
Expected 3 arguments, but got 0 or more. ts(2556)
EXPECTED: Given that the code behaves as expected, I would expect it to compile. (I would also expect the aesthetics of this use of the spread operator to divide opinion)
Three.js version
- Dev
- r116
- …
Browser
- All of them
- Chrome
- Firefox
- Internet Explorer
OS
- All of them
- Windows
- macOS
- Linux
- Android
- iOS
Hardware Requirements (graphics card, VR Device, …)
N/A
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Handbook - Interfaces - TypeScript
Class Types Interfaces describe the public side of the class, rather than both the public and private side. This prohibits you from using...
Read more >[Released] OneJS: Typescript + React (JSX) for Unity
OneJS is a Javascript Engine specifically designed for Unity. It is lightweight, performant, pure C# based, has first-class Typescript support, ...
Read more >Understanding and using interfaces in TypeScript
A class or function can implement an interface to define the implementation of the properties as defined in that interface. Over 200k developers ......
Read more >Non-Volatile Memory Host Controller Interface - NVM Express
THE AUTHORS DO NOT. WARRANT OR REPRESENT THAT SUCH USE WILL NOT INFRINGE ANY SUCH RIGHTS. THE. PROVISION OF THIS SPECIFICATION TO YOU...
Read more >PCI Express (PCIe) for KeyStone Devices User's Guide (Rev. D)
Updated the description of BAR mask register usage (Page 2-16) ... The PCI Express module does not support the following features:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve used this syntax elsewhere:
There is no list/tuple distinction at runtime, this is just for typechecking.
From this stackoverflow answer it sounds like you could define fixed array types of a specific length and reuse them but I haven’t tested it: