Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

$ExpectType did not unwrap the type alias #57

@ikatyang

Description

@ikatyang

This is just a minimal repro, the real use case is for types/npm-ramda to generate DT compatible tests so that we could put them on DT, but we got problems.

Is there any reason we can't pass the enclosingDeclaration parameter to typeToString in the expect rule?

Code

(index.d.ts)

export type Or<T, U> = T | U;

(something-tests.ts)

import * as something from 'something';

declare const result: something.Or<string, number>;

// $ExpectType string | number
result;

Expected

no errors

Actual

ERROR: 6:1   expect   Expected type to be:
  string | number
got:
  Or<string, number>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions