angular-cn/packages/common/test/pipes
cexbrayat 95830ee584 feat(common): stricter types for SlicePipe (#30156)
Adds overloads to the `transform` methods of `SlicePipe`,
to have better types than `any` for `value` and `any` as a return.
With this commit, using `slice` in an `ngFor` still allow to type-check the content of the `ngFor`
with `fullTemplateTypeCheck` enabled in Ivy:

    <div *ngFor="let user of users | slice:0:2">{{ user.typo }}</div>
                                                        |
                                                        `typo` does not exist on type `UserModel`

whereas it is currently not catched (as the return of `slice` is `any`) neither in VE nor in Ivy.

BREAKING CHANGE
`SlicePipe` now only accepts an array of values, a string, null or undefined.
This was already the case in practice, and it still throws at runtime if another type is given.
But it is now a compilation error to try to call it with an unsupported type.

PR Close #30156
2019-05-17 14:21:36 -07:00
..
deprecated test(common): disable deprecated date pipe tests on chrome mobile (#21933) 2018-02-07 12:07:31 -08:00
async_pipe_spec.ts fix(common): properly check NaN value (#22305) 2019-04-19 19:36:39 -07:00
case_conversion_pipes_spec.ts fix(common): titlecase pipe (#22600) 2018-03-23 13:42:51 -04:00
date_pipe_spec.ts feat(common): export functions to format numbers, percents, currencies & dates (#22423) 2018-02-23 15:27:10 -08:00
i18n_plural_pipe_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
i18n_select_pipe_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
json_pipe_spec.ts build: remove `main()` from specs (#21053) 2017-12-22 13:10:51 -08:00
keyvalue_pipe_spec.ts fix(common): KeyValuePipe should return empty array for empty objects (#27258) 2018-12-14 15:19:13 -08:00
number_pipe_spec.ts test(common): add PercentPipe round and trim tests (#27365) 2018-12-03 08:22:25 -08:00
slice_pipe_spec.ts feat(common): stricter types for SlicePipe (#30156) 2019-05-17 14:21:36 -07:00