microsoft / microsoft/TypeScript

Allow trailing lines in multiline comment directives

Aperta
#38,370 4 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@DanielRosenwasser ci sta già lavorando.

Dal 8/5/2020.

Bug Domain: Parser Rescheduled
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

TypeScript Version: 4.0.0-dev.20200507

Search Terms: multiline comment directive ts-expect-error ts-ignore

Code

const x = 0;

/* @ts-ignore
continuing comment 
 that could be multiline*/

x();

Expected behavior:

The comment looks like a directive to ignore the x();'s type checking complaint.

Actual behavior:

Comment directive parsing only looks at the last line of the comment. It should also allow the first line of the comment.

I'm in favor of not allowing any other lines (i.e. "middle" lines) to count as directives. Extending to allow characters after the @ts- has precedent from what's already allowed (we're really just adding newlines). But putting characters before the @ts- has a precedent of not working even in single-line comments.

/* Here we use a
@ts-ignore
 that is multiline*/

Playground Link: https://www.typescriptlang.org/play/?ssl=1&ssc=1&pln=28&pc=2#code/MYewdgzgLgBAHjAvDADAbgFAYPQCoYACUEAtAJYDmYIATgKYahhRlgCurFMoAtj3cxgYYUABYBDWKDYAbACYwARnRg9ZLGazq5sWOAAoAlGiA

Related Issues: Following discussion in https://github.com/microsoft/TypeScript/pull/38228#discussion_r420940329, as suggested by @sheetalkamat.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.