Skip to content

Implement inner type aliases #2392

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

Closed
MaxGraey opened this issue Jul 29, 2022 · 3 comments · Fixed by #2806
Closed

Implement inner type aliases #2392

MaxGraey opened this issue Jul 29, 2022 · 3 comments · Fixed by #2806

Comments

@MaxGraey
Copy link
Member

MaxGraey commented Jul 29, 2022

Example:

function foo<TArr extends ArrayLike<number>>(arr: TArr): valueof<TArr> {
    type T = valueof<TArr>; // doesn't work yet "ERROR AS100: Not implemented: Inner type alias"
    let element: T = arr[0];
    return element;
}
@CountBleck
Copy link
Member

Wouldn't the return value be T, not valueof<T>?

@MaxGraey
Copy link
Member Author

MaxGraey commented Jul 29, 2022

It should be valueof<TArr> becouse T defined in foo scope and doesn't visible globally.
See typescript playground

@CountBleck
Copy link
Member

Got it. I'm going to give this a try, but I probably won't succeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants