镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

No IntelliSense for generic literal types #34771

Closed

Description

@mjbvz

From microsoft/vscode#83375

TypeScript Version: typescript@3.8.0-dev.20191026

Search Terms:

  • suggest / completions
  • intellisense
  • generic

Repo
For the typescript:

function test<T extends "x" | "y">() {}

test<''>
  1. Trigger intellisense inside the quotes in test<''>

Expected behavior:
Suggestions for x and y returned.

Actual behavior:
No suggestions returned

Activity

  1. Chnapy commented on Dec 30, 2019

    @Chnapy

    Note that this issue also occurs with class heritage.

    type S = 'a' | 'b' | 'c';
    
    abstract class C<T extends S> {}
    
    class ImplC extends C<''> {} // try autocomplete in the ''

    But it works fine with variables.

    type S = 'a' | 'b' | 'c';
    
    type G<E extends S> = Readonly<E>;
    
    let a: G<''>;  // autocomplete works fine here
  2. mkantor commented on May 23, 2025

    @mkantor
    Contributor

    Is the fact that the cursor is within a string literal crucial to this issue, or would you also consider this a reproduction?

    function test<T extends 1 | 2 | 3>() {}
    test</* trigger completions here */>()

    I'm trying to determine if/how this differs from #52898.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions