assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

Implement inner type aliases

Open MaxGraey opened this issue 1 year ago • 3 comments

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;
}

MaxGraey avatar Jul 29 '22 06:07 MaxGraey

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

CountBleck avatar Jul 29 '22 07:07 CountBleck

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

MaxGraey avatar Jul 29 '22 07:07 MaxGraey

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

CountBleck avatar Jul 29 '22 07:07 CountBleck