Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8835581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:17:30+00:00 2026-06-14T09:17:30+00:00

First, this question first arose after working with Three.js where I tried/trying to build

  • 0

First, this question first arose after working with Three.js where I tried/trying to build interfaces for the library for my own sake.

Anyways, lets say we have the JS code:

var foo = new THREE.Vector3(0,0,0);

In TypeScript you could represent the THREE object as:

interface IThreeJS {
    Vector3(x: number, y: number, z: number): any;
}

declare var THREE: IThreeJS;

However as you can see we have ‘: any’ returning from Vector3. If I create a IVector3 interface and try doing ‘new THREE.Vector3(0,0,0): IVector3’ we get a ‘new expression on valid on constructors’. Hence having to return ‘any’

Right now the only alternative is to have the Vector3 object off of IThreeJS return ‘any’ and do:

var foo: IVector3 = new THREE.Vector3(0,0,0);

So, is there anyway to have my IThreeJS interface’s Vector3 method have a constructor AND return an IVector3?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:17:31+00:00Added an answer on June 14, 2026 at 9:17 am

    You can declare classes and modules too:

    declare module THREE {
        export class Vector3 {
            constructor(x: number, y: number, z: number);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question arose from the discussion in the comments of this answer . First,
The first part of this question is now its own, here: Analyzing Text for
I'm trying to test the first answer to this question: SQL - message schema
First this question isn't about trying to solve a specific problem. As newcomer to
I first referenced this question to get started, but reached a roadblock when trying
First of all: This question is not directly programming related. However, the problem only
The first part of this question is actually a request for confirmation based on
I'm using the first answer to this question Overcoming Python's limitations regarding instance methods
I've looked at this question: Select first instance only with XPath? But if I
This is my first time here so I hope I post this question at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.