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

fix: support 'strictTemplates' flag for public API #3623

Merged

Conversation

maxokorokov
Copy link
Member

Fixes the following use-cases for the public APIs:

  1. Boolean @Inputs like disabled where value is not required:
<input ngbButton disabled></input>

by adding

static ngAcceptInputType_disabled: boolean | '';
  1. All union types like 'vertical' | 'horizontal':
// template
<nav ngbNav [orientation]="orientation"></nav>

// component
orientation = 'vertical';

by adding:

static ngAcceptInputType_orientation: string;
  1. Cases where the directive selector matches the input with the optional value
<button [ngbPanelToggle]="p"></button>
<button ngbPanelToggle></button>

by adding:

static ngAcceptInputType_ngbPanelToggle: NgbPanel | '';

Also makes all internal library templates to work with strictTemplates.

Fixes #3619

cc @pkozlowski-opensource

Fixes the following use-cases for the public APIs:

1. Boolean `@Input`s like `disabled` where value is not required:

```html
<input ngbButton disabled></input>
```

by adding

```ts
static ngAcceptInputType_disabled: boolean | '';
```

2. All union types like `'vertical' | 'horizontal'`:

```
// template
<nav ngbNav [orientation]="orientation"></nav>

// component
orientation = 'vertical';
```
by adding:

```ts
static ngAcceptInputType_orientation: string;
```

3. Cases where the directive selector matches the input with the optional value

```html
<button [ngbPanelToggle]="p"></button>
<button ngbPanelToggle></button>
```

by adding:

```ts
static ngAcceptInputType_ngbPanelToggle: NgbPanel | '';
```

Also makes all internal library templates to work with `strictTemplates`.

Fixes ng-bootstrap#3619
@codecov-io
Copy link

Codecov Report

Merging #3623 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3623   +/-   ##
=======================================
  Coverage   91.71%   91.71%           
=======================================
  Files         100      100           
  Lines        2909     2909           
  Branches      537      537           
=======================================
  Hits         2668     2668           
  Misses        183      183           
  Partials       58       58
Flag Coverage Δ
#e2e 56.44% <ø> (ø) ⬆️
#unit 88.51% <ø> (ø) ⬆️
Impacted Files Coverage Δ
src/tooltip/tooltip.ts 98.43% <ø> (ø) ⬆️
src/tabset/tabset.ts 100% <ø> (ø) ⬆️
src/nav/nav.ts 100% <ø> (ø) ⬆️
src/datepicker/datepicker-navigation-select.ts 100% <ø> (ø) ⬆️
src/buttons/checkbox.ts 100% <ø> (ø) ⬆️
src/buttons/radio.ts 94.44% <ø> (ø) ⬆️
src/accordion/accordion.ts 98.46% <ø> (ø) ⬆️
src/datepicker/datepicker-input.ts 97.35% <ø> (ø) ⬆️
src/dropdown/dropdown.ts 94.11% <ø> (ø) ⬆️
src/popover/popover.ts 100% <ø> (ø) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad01993...3c2e145. Read the comment docs.

@maxokorokov maxokorokov merged commit eef5422 into ng-bootstrap:master Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

strictTemplates, Angular 9, Type 'string' is not assignable to type 'NgbPanel'
3 participants