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 — 'noUnusedParameters' compiler options warn the specified 'this' type as 'never used' parameter · Issue #9550 · microsoft/TypeScript

'noUnusedParameters' compiler options warn the specified 'this' type as 'never used' parameter #9550

New issue
Copy link
New issue
Copy link
Closed
Closed
'noUnusedParameters' compiler options warn the specified 'this' type as 'never used' parameter#9550
Copy link
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
TypeScript 2.0

Description

@tetsuharuohzeki
Tetsuharu Ohzeki (tetsuharuohzeki)
opened on Jul 7, 2016
Issue body actions

Environment

  • TypeScript Version 2.0.0-dev.20160707

Step to Reproduce

compile the following code with tsc test.ts --noUnusedParameters

// test.ts
class A {
    constructor(private a: number) {}

    b(this: A): number {
        return this.a;
    }
}

function bar(this: Window): string {
    return window.location.href;
}

Expected behavior

There is not any compile error.

Actual behavior

tsc reports following compilation errors

test.ts(4,7): error TS6133: 'this' is declared but never used.
test.ts(10,14): error TS6133: 'this' is declared but never used.
// test.ts
class A {
    constructor(private a: number) {}

    b(this: A): number { // error TS6133: 'this' is declared but never used.
        return this.a;
    }
}

function bar(this: Window): string { //  error TS6133: 'this' is declared but never used.
    return window.location.href;
}
Reacted by Herrington Darkholme, David Sherret, Zev Spitz, Steve Ognibene and Juliano Petronetto

Activity

  1. Tetsuharu Ohzeki (tetsuharuohzeki)
    added a commit that references this issue on Jul 7, 2016

    Fix microsoft#9550: exclude 'this' type parameters from unusedParamet…

    This issue will close once commit 1ee3f99 is merged into the 'master' branch.
    1ee3f99
  2. Mohamed Hegazy (mhegazy)
    added
    BugA bug in TypeScriptA bug in TypeScript
    on Jul 7, 2016
  3. Mohamed Hegazy (mhegazy)
    self-assigned this
    on Jul 7, 2016
  4. Mohamed Hegazy (mhegazy)
    added this to the TypeScript 2.0 milestone on Jul 7, 2016
  5. tetsuharuohzeki commented on Jul 7, 2016

    @tetsuharuohzeki
    Tetsuharu Ohzeki (tetsuharuohzeki)
    on Jul 7, 2016
    Author
    More actions

    Mohamed Hegazy (@mhegazy)

    Sorry, I missed that you assigned this to you and I opened the pull request #9557 to fix this bug.
    How should I treat #9557?

  6. mhegazy commented on Jul 7, 2016

    @mhegazy
    Mohamed Hegazy (mhegazy)
    on Jul 7, 2016
    Contributor
    More actions

    thanks saneyuki. waiting on the CI server, then will merge it.

  7. Mohamed Hegazy (mhegazy)
    removed their assignment
    on Jul 7, 2016
  8. Mohamed Hegazy (mhegazy)
    added
    FixedA PR has been merged for this issueA PR has been merged for this issue
    on Jul 7, 2016
  9. Mohamed Hegazy (mhegazy)
    closed this as completedin #9557on Jul 7, 2016
  10. Mohamed Hegazy (mhegazy)
    added 2 commits that reference this issue on Jul 7, 2016

    Merge pull request #9557 from saneyuki/fix-unusedparam-this

    This issue will close once commit 99748a2 is merged into the 'main' branch.
    99748a2

    Fix #9550: exclude 'this' type parameters from unusedParameters checks.

    This issue will close once commit 78e9fe2 is merged into the 'main' branch.
    78e9fe2
  11. falsandtru commented on Jul 12, 2016

    @falsandtru
    falsandtru (falsandtru)
    on Jul 12, 2016
    Contributor
    More actions

    Mohamed Hegazy (@mhegazy) This bug is not fixed in Visual Studio 2015 with TS2.0 ([email protected] installed by npm works correctly). Can you reopen this issue?

  12. Yui (yuit)
    added a commit that references this issue on Jul 18, 2016

    [Transforms] Merge master 07/11 into transform (#9697)

    This issue will close once commit 1c9df84 is merged into the 'main' branch.
    1c9df84
  13. microsoft
    locked and limited conversation to collaborators on Jun 19, 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

    BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

      Milestone

      • TypeScript 2.0

      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.