Skip to content

@ts-ignore not included in .d.ts file when it's needed #38628

@SephReed

Description

@SephReed

TypeScript Version: (version check command not supplied)

Search Terms:
@ts-ignore .d.ts

Code
For reasons within my codebase, the following code absolutely necessitates // @ts-ignore in order to disable an issue in which ProxiedAny<TYPE extends object> only takes objects for TYPE. Without this line, I get the error: Type 'TYPE' does not satisfy the constraint 'object'

export function isProxied<TYPE>(checkMe: TYPE | Sourcified<TYPE>)
  // @ts-ignore 
  : checkMe is ProxiedAny<TYPE>
{
  return checkMe && typeof checkMe === "object" && "_proxied" in checkMe;
}

Expected behavior:
When compiling, I would expect to find this //@ts-ignore included with the .d.ts file.

Actual behavior:
The .d.ts file is broken:
Screen Shot 2020-05-17 at 10 46 30 PM

Alternatives:
Maybe arg is TYPE should be able to do something like arg as unknown is TYPE in order to get around this issue. I'm checking if it's an object, and need a way to tell Typescript so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions