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 — StrictNullCheck incorrectly prevents the use of the indexed access operator · Issue #20141 · microsoft/TypeScript

StrictNullCheck incorrectly prevents the use of the indexed access operator #20141

New issue
Copy link
New issue
Copy link
Closed
Closed
StrictNullCheck incorrectly prevents the use of the indexed access operator#20141
Copy link
Labels
DuplicateAn existing issue was already createdAn existing issue was already created

Description

@RainingChain
Samuel Magnan (RainingChain)
opened on Nov 19, 2017
Issue body actions

TypeScript Version: 2.6.1

Code

class Klass {
  prop1:{innerNumber:number} | null;
  setInnerNumber(newInnerNumber:Klass['prop1']['innerNumber']){
    this.prop1 = {innerNumber:newInnerNumber}
  }
}
//Compile with --strictNullCheck

Expected behavior:
No error.

Actual behavior:
Property innerNumber does not exist on type '{ innerNumber:number;} | null'

Strict null check should not be checked for indexed access operator.

Activity

  1. ghost marked this as a duplicate of Non-null assertion type operator ! #14366 on Nov 19, 2017
  2. ghost added
    DuplicateAn existing issue was already createdAn existing issue was already created
    on Nov 19, 2017
  3. typescript-bot commented on Dec 4, 2017

    @typescript-bot
    TypeScript Bot (typescript-bot)
    on Dec 4, 2017
    Contributor
    More actions

    Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

  4. TypeScript Bot (typescript-bot)
    closed this as completedon Dec 4, 2017
  5. mhegazy commented on Mar 2, 2018

    @mhegazy
    Mohamed Hegazy (mhegazy)
    on Mar 2, 2018
    Contributor
    More actions

    This should be doable today using NonNullable type

  6. microsoft
    locked and limited conversation to collaborators on Jul 3, 2018
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

    DuplicateAn existing issue was already createdAn existing issue was already created

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      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.