Skip to content

Annotated type vars have incorrect output type name #110

@niloc132

Description

@niloc132

Annotated type variables can be written out to typescript with an invalid type name. This was noticed on a properties, but it could be wrong elsewhere.

Example that fails:

@TsInterface
@TsName(namespace = "myapp")
public interface MyOptional<T> {
  @JsProperty
  @JsNullable
  T getValue();
}

As @JsNullable is a TYPE_USE annotation, it apparently is attached to the T instead of the method, and accidentally is toString()'d when the type is written out in TS.

Expected output:

export namespace myapp {
        interface MyOptional<T> {
                get value(): null|T;
                // or this might also be valid, still not sure why it sometimes changes
                //readonly value?: null | T;
        }
}

Actual output:

export namespace myapp {
	export interface JsOptional<T> {
		readonly value?:null|@jsinterop.annotations.JsNullable T;
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions