Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@types/react] Refer to string for the download attribute #64460

Closed

Conversation

autarc
Copy link

@autarc autarc commented Feb 23, 2023

Pull Request

Description

Currently the download attribute of anchor elements and derived ones are specified as optional or any. Based on the HTML specification and common references the value is expected to be a string if it is set. The adjustment helps to guide the usage while also easing the integration at environments which enforce a stricter policy (no any).

Template Checklist

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Run npm test <package to test>.

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes

@typescript-bot
Copy link
Contributor

typescript-bot commented Feb 23, 2023

@autarc Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through.

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • 🕐 Most recent commit is approved by a DT maintainer

Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.

Inactive

This PR has been inactive for 31 days — it is considered abandoned, and therefore closed!


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 64460,
  "author": "autarc",
  "headCommitOid": "f131f891d34a862f77a66b17d8751cd60688fe69",
  "mergeBaseOid": "07b6d02468ba8589ffdafdd7db3a16fd12b3aaf7",
  "lastPushDate": "2023-02-23T10:17:05.000Z",
  "lastActivityDate": "2023-04-18T06:48:13.000Z",
  "hasMergeConflict": false,
  "isFirstContribution": true,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "react",
      "kind": "edit",
      "files": [
        {
          "path": "types/react/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/test/elementAttributes.tsx",
          "kind": "test"
        },
        {
          "path": "types/react/v15/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/v16/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/v16/test/elementAttributes.tsx",
          "kind": "test"
        },
        {
          "path": "types/react/v17/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/react/v17/test/elementAttributes.tsx",
          "kind": "test"
        }
      ],
      "owners": [
        "johnnyreilly",
        "bbenezech",
        "pzavolinsky",
        "ericanderson",
        "DovydasNavickas",
        "theruther4d",
        "guilhermehubner",
        "ferdaber",
        "jrakotoharisoa",
        "pascaloliv",
        "hotell",
        "franklixuefei",
        "Jessidhia",
        "saranshkataria",
        "lukyth",
        "eps1lon",
        "zieka",
        "dancerphil",
        "dimitropoulos",
        "disjukr",
        "vhfmag",
        "hellatan",
        "priyanshurav",
        "Semigradsky"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "changereq",
      "reviewer": "eps1lon",
      "date": "2023-04-18T06:48:13.000Z"
    }
  ],
  "mainBotCommentID": 1441491431,
  "ciResult": "pass"
}

@typescript-bot typescript-bot added Critical package Untested Change This PR does not touch tests labels Feb 23, 2023
@typescript-bot typescript-bot added this to Waiting for Code Reviews in New Pull Request Status Board Feb 23, 2023
@typescript-bot
Copy link
Contributor

@typescript-bot typescript-bot removed the Untested Change This PR does not touch tests label Feb 23, 2023
@DangerBotOSS
Copy link

Inspecting the JavaScript source for this package found some properties that are not in the .d.ts files.
The check for missing properties isn't always right, so take this list as advice, not a requirement.

react (unpkg)

was missing the following properties:

  1. unstable_act

Generated by 🚫 dangerJS against f131f89

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Feb 23, 2023
Copy link
Collaborator

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no restrictions on allowed values

Did you check when we introduced this type if we made it any on purpose since the spec has no restriction on the type?

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Feb 23, 2023
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Needs Author Action in New Pull Request Status Board Feb 23, 2023
@typescript-bot
Copy link
Contributor

@autarc One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits. Thank you!

@autarc
Copy link
Author

autarc commented Feb 23, 2023

There are no restrictions on allowed values

Did you check when we introduced this type if we made it any on purpose since the spec has no restriction on the type?

Apparently it was introduced some time ago by the definitions carrying for v16/v17 with this commit (09d10b6#diff-b90a3db64689e262ba23dd8f4f12f7e1b1a8b676fa3123655f6a7b99a8e426f0R1846) based on this pull request (#48971). Are you aware of situation or issue which lead to marking it as any so far?

@typescript-bot typescript-bot added the Abandoned This PR had no activity for a long time, and is considered abandoned label Mar 18, 2023
@typescript-bot
Copy link
Contributor

@autarc I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on Mar 25th (in a week) if the issues aren't addressed.

@autarc
Copy link
Author

autarc commented Mar 18, 2023

@eps1lon Could you share some thoughts about the mention here (#64460 (comment))? As suggested I checked where it came from but there didn't seem a deeper reason from what I got. Might of course be that I missed something you're more aware based on the PR at which it got introduced. As the official specification describes the value as a string (which in the context of an HTML attribute that specifies a filename seems reasonable to me) I thought it might be preferred following the standard rather than having it as any.

@autarc autarc requested review from eps1lon and removed request for Jessidhia and johnnyreilly March 18, 2023 19:13
@typescript-bot typescript-bot removed the Abandoned This PR had no activity for a long time, and is considered abandoned label Mar 18, 2023
@eps1lon
Copy link
Collaborator

eps1lon commented Mar 20, 2023

You should go beyond the apparent git-blame and check when it as actually introduced into the typings. It's unlikely we actually added it when copying types.

@typescript-bot typescript-bot added the Abandoned This PR had no activity for a long time, and is considered abandoned label Apr 14, 2023
@typescript-bot
Copy link
Contributor

@autarc I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on Apr 19th (in a week) if the issues aren't addressed.

@autarc
Copy link
Author

autarc commented Apr 17, 2023

Taking a look at the react handling itself is supporting any kind of attribute values, although it basically converts truthy ones as their string representations while omitting falsy ones. A coverage for the different cases is available here.

Having that in mind the current notion of any is a direct matching of the implementation rather than the intent. A numeric value and boolean true might also be considered as values with impact but the rest are probably not that helpful. Would you @eps1lon say narrowing the type to those 3 along with undefined is reasonable or should it remain relaxed as any?

@typescript-bot typescript-bot removed the Abandoned This PR had no activity for a long time, and is considered abandoned label Apr 17, 2023
Copy link
Collaborator

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still not clear when this was introduced. The original blame points to bcaf366 but at that point everything was any. So is this just a leftover or was there a single commit that narrowed all attributes properly but excluded this prop for a specific reason.

Also please rebase this PR on top of latest master and port changes to the new ts5.0 fork.

@typescript-bot typescript-bot added the Abandoned This PR had no activity for a long time, and is considered abandoned label May 11, 2023
@typescript-bot
Copy link
Contributor

@autarc I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on May 18th (in a week) if the issues aren't addressed.

@typescript-bot typescript-bot removed this from Needs Author Action in New Pull Request Status Board May 20, 2023
@typescript-bot
Copy link
Contributor

@autarc To keep things tidy, we have to close PRs that aren't mergeable and don't have activity in the last month. No worries, though — please open a new PR if you'd like to continue with this change. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Abandoned This PR had no activity for a long time, and is considered abandoned Critical package Revision needed This PR needs code changes before it can be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants