microsoft / microsoft/TypeScript

@ts-ignore is broken in 3.6 when code line is broken into 2 lines

Open
#33,256 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Proposal Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Search Terms:
@ts-ignore
ts-ignore
ignore
multiline
Code

const veryLongStructureNameWithFooInside = {
  foo: (x: number): Promise<number> => {
    return Promise.resolve(x);
  },
};
// @ts-ignore
veryLongStructureNameWithFooInside
  .foo() // Notice the line break here caused by prettier
  .then((result) => {
    console.log(result);
  })
  .catch((err) => {
    console.log(err);
  });

Expected behavior:

There should be no errors as @ts-ignore is set on the function call (works in 3.5.2)

Actual behavior:

In next version the following error occurs:

error TS2554: Expected 1 arguments, but got 0.

   .foo()
      ~~~~~

      foo: (x: number): Promise<number> => {
               ~~~~~~~~~
    An argument for 'x' was not provided.

Playground Link:
playground

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Playground and the provided multiline @ts-ignore reproduction, comparing TypeScript 3.5.2 with the 3.6 behavior. Trace how the directive is associated with the broken-up call, then verify that the example reports no error while preserving diagnostics for unrelated code.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.