microsoft / microsoft/TypeScript

Annotations/IntelliSense gets lost with simple `&` and `|` joins or utilities

Offen
#57,418 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Experience Enhancement Help Wanted Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

🔎 Search Terms

IntelliSense, comments, annotations, symbol annotation, utilities, utility, union, intersection

🕗 Version & Regression Information
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about annotations
⏯ Playground Link

https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBASwHY2FAZgQwMbDgMQgjgG8AoOOAegCoa4BBJOTJJCGTGBCZ9aOOgRQAzvDBQIYNDACecGlQqDhYgAqTpsWQC44AIyIAbYK2W16TFmw5cefASODZeAEzgSpM+YuVOXSK4aXtp6SACuALb6aGQAvmRkoJCwiChoWLhwAEKYUKTmdIzMrOyc3LyCAjAAFni1wu6eWnIKSpQNUEGa3npiUMgA5vGJAWJVEHqExAC8BZRUVHCSRkZwEABuaHAwxIPA8KW2FUjKQqIwwS26gphGTgA05ksra5vbu3D7hzbl9n7ONxXXpwAAsACYRklwNB4HJpAQiExXAB5KC5fJzAAU0zgADIcnkAJRwAA+iOI5Ixo14434EGRGKmSMCaIxcDm5AWLwgq3e+SOf1pcFcvAA5PAAO7QADWcDqUGAZ1Ulx6oVu92AT0o-iBarkenB2p2NUawPVACI6nyLVDFnBItA8C5ImATCA4KBMK6THAALQBwNB4OBxLwvAAJWAAEdwsJgAwYAAZUxiFFIYAAHgAKg84ABpYCyESekCoQIlmVFiDoODZjlwKuyGt1gB8DbUCGwMszylzygAoiBsEZwq4s02W7mC0WRK2yO28couZQ4ABtfNpGfFgC6foA-Hoo7H465M53uzm8-nW4u4Go8tw7ueuz3p0OR2Os4Xi9fb-PKDiDdZx3MNZARRMU0wNMM1xOZjzjRVINTGB0yzaY8zFc51H1WQxTJOAxV1QJzTkMV5zIMZ4AAK3CGDgGmPRkOg1DYKIBsV3tV5+WsMo7GFO4RGIUUkAlOBpSgOUFSVShsNVEIDQ1Jx4iAA

💻 Code
// follow Playground link to see behavior

export interface Foo {
  /** An annotation for first property */
  firstProperty: boolean
  /** An annotation for second property */
  secondProperty: number
}

export interface Bar {
  /** An annotation for the third property */
  thirdProperty: string
}

const foo: Foo = {
  // roll over to get annotation
  firstProperty: false,
  // roll over to get annotation
  secondProperty: 42
}

export type FooAndOrBar = (Foo & Bar) | Foo | Bar

const fooAndBar: FooAndOrBar = {
  // rollover annotations don't work here
  firstProperty: true,
  secondProperty: 2,
  thirdProperty: "hello"
}
🙁 Actual behavior

IntelliSense doesn't work on properties after running through & (intersections) with | (unions) or more complex type manipulation.

🙂 Expected behavior

I expected the annotation to "come along" with the symbol and appear in IntelliSense.

Additional information about the issue

No response

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der verlinkten TypeScript Playground-Reproduktion und vergleiche die Property-IntelliSense für Foo, Bar und FooAndOrBar. Verfolge, wie Annotationen durch die Intersection- und Union-Typen erhalten bleiben, und überprüfe anschließend, dass die Rollover-IntelliSense die erwarteten Annotationen für alle drei Properties anzeigt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
compilers, developer-experience
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.