79314295

Date: 2024-12-28 17:56:52
Score: 1
Natty:
Report link

I had this same problem, but it started when I made a deeply recursive type. I think while the intellisense was trying to making sense of the type, it stuck on an infinite loop, which would be why it was stuck on loading.

What I did that solved the issue on my case was:

For a reference on the recursive type I made:


/**
 * Enumerate numbers from 0 to N-1
 * @template N - The upper limit (exclusive) of the enumeration
 * @template Acc - An accumulator array to collect the numbers
 *
 * @see {@link https://stackoverflow.com/a/39495173/19843335 restricting numbers to a range - StackOverflow}
 */
type Enumerate<
    N extends number,
    Acc extends number[] = [],
> = Acc["length"] extends N // Check if the accumulator array's length has reached N
    ? Acc[number] // If so, return the numbers in the accumulator array as a union type
    : Enumerate<N, [...Acc, Acc["length"]]>; // Otherwise, continue the enumeration by adding the current length to the accumulator array

/**
 * Create a range of numbers from F to T-1
 * @template F - The starting number of the range (inclusive)
 * @template T - The ending number of the range (exclusive)
 *
 * @see {@link https://stackoverflow.com/a/39495173/19843335 restricting numbers to a range - StackOverflow}
 */
type IntRange<F extends number, T extends number> = Exclude<
    Enumerate<T>, // Enumerate numbers from 0 to T-1
    Enumerate<F> // Exclude numbers from 0 to F-1, resulting in a range from F to T-1
>;

/**
 * Define a range of numbers for question steps, from 1 to 10 (inclusive of 1, exclusive of 10)
 *
 * @see {@link https://stackoverflow.com/a/39495173/19843335 restricting numbers to a range - StackOverflow}
 */
type QuestionsStepsRange = IntRange<1, 11>;

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Blacklisted phrase (1): StackOverflow
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Henry Ozoani