Skip to content

@types/node Use Typescript 3.7 asserts syntax for node's assert function #40415

@MajorBreakfast

Description

@MajorBreakfast

About the asserts feature:
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions
microsoft/TypeScript#32695

Basically I would like to change:

function internal(value: any, message?: string | Error): void;

into this:

function internal(value: any, message?: string | Error): asserts value;

Since this TypeScript feature has been released only recently, how should this best be added to the types without breaking compilation on older TypeScript versions?

cc @Flarna @rbuckton @jstewmon (This is obviously not the complete list of authors because I didn't want to ping too many people. While browsing the source these names came up. Please ping anyone who you think should be involved in the discussion)

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