question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular 11 Strict: can't access OverlayScrollbars Inputs

See original GitHub issue

Describe the bug If you create a new Angular 11 app with strict type checking (ng new <name> --strict) it sets angularCompilerOptions.strictInputAccessModifiers to true in tsconfig.json. strictInputAccessModifiers honors @Input() access modifiers, and because they are currently set to private they are inaccessible:

https://github.com/KingSora/OverlayScrollbars/blob/914836370aa444b04cc9e0c2bca63915ac8fdba0/packages/overlayscrollbars-ngx/src/overlayscrollbars.component.ts#L31-L32

This is the compiler error you’ll see:

error TS2341: Property '_options' is private and only accessible within class 'OverlayScrollbarsComponent'.

     <overlay-scrollbars [options]="scrollOptions">
                         ~~~~~~~~~~~~~~~~~~~~~~~~~

To Reproduce Steps to reproduce the behavior:

  1. Set strictInputAccessModifiers to true in tsconfig.json for an Angular 11 app
  2. Attempt to use the options or extensions OS inputs

Expected behavior There should be no template errors when using strict type checking

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
KingSoracommented, Dec 16, 2020

Fixed with version 1.13.1 / "overlayscrollbars-ngx": "0.2.3"

1reaction
axelstudioscommented, Nov 23, 2020

I’ve done something similar, I think you would want to keep the variable private and change the Inputs to setters (and no getters). Something like this:

private _options: OverlayScrollbars.Options;

@Input() set options(options: OverlayScrollbars.Options | undefined) {
  if (options) {
    this._options = options;
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 2+: Multiple definitions of a property not allowed in ...
I had the same issue, it still exists in Angular. Reason of error. SyntaxError: Multiple definitions of a property not allowed in strict...
Read more >
overlayscrollbars-ngx - npm
OverlayScrollbars for Angular. ... Start using overlayscrollbars-ngx in your project by running `npm i overlayscrollbars-ngx`.
Read more >
× typeerror: cannot read properties of null ... - You.com
I'm trying to add a searchBox to my Google Maps API map, I already activated placesAPI but when I try to call it...
Read more >
@storybook/addon-controls | Yarn - Package Manager
Interact with component inputs dynamically in the Storybook UI ... Support Angular 15.0.4 #20287; CLI: execute automigrations when pressing enter in the ...
Read more >
Diff - ff1db7c1c9..54c4473401 - chromium/src - Git at Google
-40,11 +40,11 @@ # Three lines of non-changing comments so that # the commit queue can ... + '/external/github.com/open-source-parsers/jsoncpp.git' + '@' + ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found