Skip to content

Make things as optional when at least one engine lacks support #998

Open

Description

From #837 (comment).

Currently we add types when at least two browser engines add supports, but that doesn't mean it's available everywhere. Making such types as optional may help devs to feature test as needed.

What do you think? Orta Therox (@orta)

Activity

  1. orta commented on Mar 29, 2021

    @orta
    Contributor

    I think it's more ergonomic to assume it's there, even if it isn't. IMO, we probably shouldn't default to optional.

    Perhaps a more general solution is that be that the compiler doesn't raise when you make checks against existing functions which were originally defined in the DOM?

  2. saschanaz commented on Mar 29, 2021

    @saschanaz
    ContributorAuthor

    That also sounds good.

  3. Bashamega commented on Oct 29, 2025

    @Bashamega
    Contributor

    Hello Kagami Sascha Rosylight (@saschanaz), Jake Bailey (@jakebailey)

    This is an important issue, because most people don't check the compatibility list.
    I think a better solution is to annotate these classes with something that indicates they are still in development. For example, we can use the @alpha or @beta tag

  4. saschanaz commented on Oct 31, 2025

    @saschanaz
    ContributorAuthor

    In an ideal world there would be a babel-like feature in TS compiler that would hide things based on user expectation config. If that comes in reality then we wouldn't need to manually hide things based on BCD...

  5. Bashamega commented on Oct 31, 2025

    @Bashamega
    Contributor

    My proposal is a patch until typescript implements this.
    Do you think there is a better way to handle this right now?

  6. saschanaz commented on Oct 31, 2025

    @saschanaz
    ContributorAuthor

    Custom tags wouldn't affect the compiler in any way, no?

  7. Bashamega commented on Oct 31, 2025

    @Bashamega
    Contributor

    Custom tags won't affect it.
    It will be just like @deprecated
    And people who want to make sure their code works on all browsers can use an ESLint plugin.

  8. saschanaz commented on Oct 31, 2025

    @saschanaz
    ContributorAuthor
  9. Bashamega commented on Oct 31, 2025

    @Bashamega
    Contributor

    I didn't know this. Maybe choose a tag from the list.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions