Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please Allow Mixins to function properly with new-able types #53737

Open
akwotom opened this issue Apr 11, 2023 · 1 comment
Open

Please Allow Mixins to function properly with new-able types #53737

akwotom opened this issue Apr 11, 2023 · 1 comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@akwotom
Copy link

akwotom commented Apr 11, 2023

Bug Report

If we declare a new-able type, that is a mixin with the generic parameter it uses, the whole type is not processed.
For example, doing this, won't work

// In types.d.ts
namespace test.ts.bug{
    var MyType: {
        new <T>(): T & {
            additional: "somevalue"
        };
    }
}
// Then, in VS code, we make use of the type as such
/** @extends {test.ts.bug.MyType<{tsc: "cool"|"sweet"}>} */
class SomeClass extends Object{
}
const myVar = new SomeClass()

Suppose you try to use myVar, you won't see the any of the properties corrected listed, and auto-completed.

However, if you declared it like this

// In types.d.ts
namespace test.ts.working{
    var MyType: {
        new <T>():  {
            additional: "somevalue";
            main: T
        };
    }
}

And obviously, did the following in js

// Then, in VS code, we make use of the type as such
/** @extends {test.ts.working.MyType<{tsc: "cool"|"sweet"}>} */
class SomeClass extends Object{
}
const myVar = new SomeClass()

then with const myVar = new SomeClass(), the properties additional, and main.tsc are auto-completed very well.

🔎 Search Terms

mixins new-able newable types

🕗 Version & Regression Information

Same version with vs code

⏯ Playground Link

Playground link with relevant code

🙁 Actual behavior

const myVar = new SomeClass() doesn't auto-complete in VS code

🙂 Expected behavior

const myVar = new SomeClass() is supposed to have the tsc, and additional set to true

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this labels Apr 11, 2023
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Apr 11, 2023
@Andarist
Copy link
Contributor

I can't repro this quickly. Could you prepare a runnable repository that would showcase the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

3 participants