GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Incorrect @Input size typing when strictTemplates is enabled · Issue #220 · angular-split/angular-split

Incorrect @Input size typing when strictTemplates is enabled #220

New issue
Copy link
New issue
Copy link
Closed
#353
Closed
Incorrect @Input size typing when strictTemplates is enabled#220
#353
Copy link
Labels
bug
Milestone
v6

Description

@KeithGillette
KeithGillette
opened on Feb 19, 2020
Issue body actions

Describe the bug
AOT compilation build under Angular 9 with angularCompilerOptions.strictTemplates: true in tsconfig.app.json generates a error TS2322: Type 'string' is not assignable to type 'number' when binding <as-split-area [size]="'*'">, as the @Input size is typed as number | null in the source code, though the documentation clearly states it can also be bound to '*' in pixel mode.

Reacted by Maksym Kobieliev, Guyutongxue, teuf22, laggage, Harpush and Thomas Peugeot

Activity

  1. KeithGillette
    added
    bug
    on Feb 19, 2020
  2. Maximaximum commented on Apr 29, 2020

    @Maximaximum
    Maximaximum
    on Apr 29, 2020
    More actions

    I'm having exactly the same issue. This is clearly a bug, so I hope it will be fixed

  3. Maximaximum commented on Jun 5, 2020

    @Maximaximum
    Maximaximum
    on Jun 5, 2020
    More actions

    Hm, I wonder if this project is still maintained? 😢

  4. literalpie commented on Jun 18, 2020

    @literalpie
    literalpie
    on Jun 18, 2020
    More actions

    As a workaround, you can use $any in the template

    	<as-split-area [size]="$any('*')">hello</as-split-area>
    
    Reacted by beeman and Keith Gillette
  5. beeman
    added this to the v6 milestone on Jul 23, 2020
  6. arthur-clifford commented on Aug 22, 2020

    @arthur-clifford
    arthur-clifford
    on Aug 22, 2020
    More actions

    I was running into an issue with the size not being settable as a string due to typescript checking when using setVisibleAreaSizes
    because I was using a string that included a calc( ... ) value.
    The error I got was:
    this.upperSplit.setVisibleAreaSizes([size1, size2, size3]);
    ~~~~~

    node_modules/angular-split/lib/interface.d.ts:40:18
    40 export interface IOutputAreaSizes extends Array<number | '*'> {

    Note: size2 was a string.

    Being a very naughty programmer I altered the interface defined in angular-split/lib/interface.d.ts so that it read:
    export interface IOutputAreaSizes extends Array<number | string | '*'> {

    That solved my issue with no known other side effects, other than having to make that tweak any time I update.

    I imagine this is causing the size property not accepting a string in strict mode as well.

    I'd like to more formally request that the interface be updated to include string as a type unless there is a good a really good reason not to.

  7. ahnpnl commented on Oct 28, 2020

    @ahnpnl
    ahnpnl
    on Oct 28, 2020
    More actions

    Hi, any updates on this issue ?

  8. beeman commented on Oct 28, 2020

    @beeman
    beeman
    on Oct 28, 2020
    Contributor
    More actions

    Hi, any updates on this issue ?

    For now the recommend way to handle this is using $any() as mentioned here.

    Once v5 is released, built using Angular 10, I will consider fixing this in v6.

    Reacted by Ahn
  9. KeithGillette commented on Oct 28, 2020

    @KeithGillette
    KeithGillette
    on Oct 28, 2020
    Author
    More actions

    @beeman — Wasn't this incorrect typing already resolved in your ngx-split fork? We've been using that fork without the $any('*') work-around in our Angular 10 project. I see now that ngx-split is deprecated and angular-split is being actively maintained again.

  10. beeman commented on Oct 28, 2020

    @beeman
    beeman
    on Oct 28, 2020
    Contributor
    More actions

    @beeman — Wasn't this incorrect typing already resolved in your ngx-split fork? We've been using that fork without the $any('*') work-around in our Angular 10 project. I see now that ngx-split is deprecated and angular-split being actively maintained again.

    Correct, I solved it there so I know what's the fix.

    I'm deprecated my fork because the original author decided to hand over maintainence of this library.

    Just didn't get to merging back my fixes.

  11. KeithGillette commented on Jan 21, 2021

    @KeithGillette
    KeithGillette
    on Jan 21, 2021
    Author
    More actions

    Any timeline for merging the fix for this issue from ngx-split, @beeman?

    We've been holding off on switching back from ngx-split to angular-split until this issue is closed, but now ngx-split throws a fatal error at runtime under [email protected]:

    core.js:6156 ERROR Error: Uncaught (in promise): Error: ASSERTION ERROR: Expecting flags [Expected=> number === boolean <=Actual]
    Error: ASSERTION ERROR: Expecting flags [Expected=> number === boolean <=Actual]
    
  12. beeman commented on Jan 21, 2021

    @beeman
    beeman
    on Jan 21, 2021
    Contributor
    More actions

    @KeithGillette can't really give a timeline at this point, sorry. Simply too busy with other things.

    I think the workaround using $any('*') is relatively simple, so you might consider that.

  13. lf-novelt commented on Mar 1, 2021

    @lf-novelt
    lf-novelt
    on Mar 1, 2021
    Contributor
    More actions

    thanks for the workaround.
    However I wonder if this is symply a typing issue, or an actual issue with the code, as the project is in TypeScript, so the typing are generated from the actual code, and the code really expects the size Input to be a Number as seen here

    angular-split/projects/angular-split/src/lib/directive/split-area.directive.ts

    Lines 23 to 25 in 6596943

    private _size: number | null = null
    @Input() set size(v: number | null) {

    I am trying to find where this size === "*" case is handled in the source...

  14. beeman commented on Mar 1, 2021

    @beeman
    beeman
    on Mar 1, 2021
    Contributor
    More actions

    Hey @lf-novelt , if you check #289 you can see where it's set. Once I finish that PR it will work without the workaround.

    Reacted by Louis Frament and Thomas Peugeot
  15. beeman
    changed the title [-]Incorrect @Input size typing causes `error TS2322: Type 'string' is not assignable to type 'number'` when `tsconfig.json` `angularCompilerOptions.strictTemplates: true`[/-] [+]Incorrect @Input size typing when strictTemplates is enabled[/+] on Mar 1, 2021
  16. beeman
    closed this as completedin #353on Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      • v6No due date

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.