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

typescript: possibility to specify type format flags #276

Closed
devversion opened this issue Oct 5, 2018 · 1 comment
Closed

typescript: possibility to specify type format flags #276

devversion opened this issue Oct 5, 2018 · 1 comment

Comments

@devversion
Copy link
Member

devversion commented Oct 5, 2018

In some API doc type classes, the TypeScript package just uses the plain typeToString method. By default this method truncates long types and therefore causes unexpected results.

We should allow users to overwrite the typeToString logic using the recently introduced Host class. Probably in the future it might be worth passing NoTruncation by default.

https://github.com/angular/dgeni-packages/blob/master/typescript/src/api-doc-types/ConstExportDoc.ts#L22

devversion added a commit to devversion/material2 that referenced this issue Oct 5, 2018
* By default TypeScript truncates the types when calling `typeToString`. Since we don't want to truncate the types automatically, we need to work around: angular/dgeni-packages#276 until there is a possibility to change this using the `tsHost`.
vivian-hu-zz pushed a commit to angular/components that referenced this issue Oct 5, 2018
* By default TypeScript truncates the types when calling `typeToString`. Since we don't want to truncate the types automatically, we need to work around: angular/dgeni-packages#276 until there is a possibility to change this using the `tsHost`.
petebacondarwin added a commit to petebacondarwin/dgeni-packages that referenced this issue Oct 8, 2018
This fix also includes a refactoring that allows the developer to
override the default behaviour of this rendering by providing their
own `Host` implementation.

BREAKING CHANGE:

The way that some types are rendered has changed. It is believed that
this is better but you may want to check in case your expectation is
different.

* `let myVar = 42` used to render the type as `42` but
will now render as `number`.

* type parameters of the following call signature:

```
<T, U extends Findable<T>>(param: T) : U
```

will be rendered as `<T, U>` whereas before it might be have been
rendered as `<T, U extends Findable<T>>`.

* structural types are now rendered as a single line:

```
{ foo: string; }
```

rather than

```
{
    foo: string;
}
```

* Results of complex calls might become `any` whereas, previously,
the call itself was rendered. For example:

```
Object.assign(super.someProp, {
  bar: 'baz'
});
```

Fixes angular#276
@devversion
Copy link
Member Author

devversion commented Oct 23, 2018

Closed with 5d90fd9

roboshoes pushed a commit to roboshoes/material2 that referenced this issue Oct 23, 2018
* By default TypeScript truncates the types when calling `typeToString`. Since we don't want to truncate the types automatically, we need to work around: angular/dgeni-packages#276 until there is a possibility to change this using the `tsHost`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant