Skip to content

About the typeof ES6 import expressionΒ #61241

Closed as not planned
Closed as not planned
@suguanYang

Description

@suguanYang

πŸ”Ž Search Terms

typeof import("x") should be the same as the return type of import expression call

πŸ•— Version & Regression Information

All version

⏯ Playground Link

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAKjgQwM5wEoFNkGN4BmUEIcA5FDvmQNwBQuEAdqvJXvALxyiSwAUFKjDIBKenRgBPMFjgBJVAFEAjgFdkAGwA8AFQA0cAKoA+ON11wsADxhYmAE3RG4AfmNXb9p3EvuYUGpyAFxwBFqoIWERWBKSMnKKqhqa2KhqmjAAjOYKyupa2tKyEARw7PiGxVilPODQMIIVIqImNHAA9B3RmpHxsnnJWmkZMABMuUkFOtW12BxVCbW8DU3CYm2d3QFBdHRAA

πŸ’» Code

import * as React from 'react';
const react = import('react');

type IsEqual<T, U> = T extends U ? U extends T ? true : false : false;

πŸ™ Actual behavior

type IsEqualResult1 = IsEqual<typeof react, typeof import('react')>; // false
type IsEqualResult2 = IsEqual<typeof React, typeof import('react')>; // true

πŸ™‚ Expected behavior

type IsEqualResult1 = IsEqual<typeof react, typeof import('react')>; // true
type IsEqualResult2 = IsEqual<typeof React, typeof import('react')>; // false

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Not a DefectThis behavior is one of several equally-correct options

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions