Skip to content

with --noUnusedParameters how can i skip uneeded parameters #9458

Closed
@zpdDG4gta8XKpMCd

Description

@zpdDG4gta8XKpMCd

sorry for being persistent, same question as in

#9403 (comment)

how is this going to work with unused parameters?

fiction third(x:any, y: any, z: T) : T { return z; } // need only last one

Activity

mhegazy

mhegazy commented on Jun 30, 2016

@mhegazy
Contributor

i was thinking of _ as a special case. but that does not seem nice. the other option is to use arguments.

added
SuggestionAn idea for TypeScript
Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.
on Jun 30, 2016
changed the title [-]how can i skip uneeded parameters[/-] [+]With `--nuUnusedParameters`, how can i skip uneeded parameters[/+] on Jun 30, 2016
zpdDG4gta8XKpMCd

zpdDG4gta8XKpMCd commented on Jun 30, 2016

@zpdDG4gta8XKpMCd
Author

_ works well in f#, and i like it a lot, but might be a breaking change for stuff like underscore.js

RyanCavanaugh

RyanCavanaugh commented on Jun 30, 2016

@RyanCavanaugh
Member

I would propose that any local starting with _ is not subject to unused checks. For multiple parameters you could then write (_0, _1, x) => x

zpdDG4gta8XKpMCd

zpdDG4gta8XKpMCd commented on Jun 30, 2016

@zpdDG4gta8XKpMCd
Author

consider third<T>(,, z: T): T { return z; }

RyanCavanaugh

RyanCavanaugh commented on Jul 1, 2016

@RyanCavanaugh
Member

Discussed quite a bit here https://esdiscuss.org/topic/uninteresting-parameters and I would defer to their judgement

removed
Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.
on Jul 1, 2016
added a commit that references this issue on Jul 1, 2016

Fix #9458: exclude parameters starting with underscore from unusedPar…

5de7ca2
mhegazy

mhegazy commented on Jul 1, 2016

@mhegazy
Contributor

I have a fix out in #9464. any parameter name starting with _ is exempt from the check.

mhegazy

mhegazy commented on Jul 1, 2016

@mhegazy
Contributor

if @RyanCavanaugh gives me a :+: i can get it in

zpdDG4gta8XKpMCd

zpdDG4gta8XKpMCd commented on Jul 1, 2016

@zpdDG4gta8XKpMCd
Author

@RyanCavanaugh the discussion you mentioned ended nowhere, but I like the point that was raised there: destructuring has been already accepting commas for unused array elements:

const values = [1,2,3];
const [,,z] = values;
changed the title [-]With `--nuUnusedParameters`, how can i skip uneeded parameters[/-] [+]with --noUnusedParameters how can i skip uneeded parameters[/+] on Jul 1, 2016

22 remaining items

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

    CommittedThe team has roadmapped this issueSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @KnisterPeter@zpdDG4gta8XKpMCd@kitsonk@JoshuaKGoldberg@pewinski

        Issue actions

          with --noUnusedParameters how can i skip uneeded parameters · Issue #9458 · microsoft/TypeScript