microsoft / microsoft/TypeScript
Comment directive activated when longer string used
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
TypeScript Version: typescript@4.0.0-dev.20200526
NodeJS Version: v12.16.2
Visual Studio Code:
Version: 1.45.1 (system setup)
Commit: 5763d909d5f12fe19f215cbfdd29a91c0fa9208a
Date: 2020-05-14T08:27:35.169Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 6.1.7601
Search Terms: comment directive, @ts-ignore
Code
let obj = { }
// @ts-ignoreThisShouldNotMatchButItDoes
console.log( `obj.a = ${obj.a}` )
Expected behavior:
Property 'a' does not exist on type 'object'.ts(2339)
Actual behavior:
compile time: no 2339 error or indication in VS Code
run time: obj.a = undefined
Description
Visual Studio code and running tsc will produce error 2339 when the comment directive is removed. When adding in the comment // @ts-ignore both Visual Studio code and tsc will ignore the error. However, misspelling ts-ignore as ts-ignoree or ts-ignoreThisShouldNotMatchButItDoes will invoke the @ts-ignore directive and ignore the error.
I didn't test other directives to see whether they had similar issues... trying to keep things simple, but this issue could be symptomatic of all comment directives, assuming they re-use the same code for parsing.
Related Issues: None that I could find. Searched under @ts-ignore, comment directive
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con il comportamento del compilatore TypeScript mostrato nell’esempio di codice e nel link Playground dell’issue, usando la configurazione TypeScript 4.0.0-dev.20200526 indicata. Riproduci il caso // @ts-ignoreThisShouldNotMatchButItDoes con tsc e confrontalo con la direttiva scritta correttamente e con le varianti errate. Il lavoro è completato quando solo la direttiva di commento esatta sopprime l’errore 2339, mentre le stringhe più lunghe non lo fanno.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100