You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importtype{Component}from'react';// TS errors on this while it is imported as a typeconstComponent: Component|null=null;importtype{FC}from'react';// TS allows this as it's a typeconstFC: FC|null=null;
π Actual behavior
TypeScript reports the following error:
Import declaration conflicts with local declaration of Component.
π Expected behavior
Because Component is imported as a type, it should be merged with the variable Component without emitting an error.
π Search Terms
Declaration merging, isolatedModule, type import conflict
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?isolatedModules=true&ts=5.4.0-beta#code/JYWwDg9gTgLgBDAnmApnA3nAwhcEB2K+8AvnAGZS5wDkUKAhgMYw0DccA9J3ACoDKcFFCpQAznAIIAFsAkB3WQBs0weHLihIsFABM4DCQwTIUAKCYEx8HHkLEAXNlyR78AD5x8AVyVK4ALxevkpsZmZa0PBIqBhwAGJYcGSU1HSMLOxcPAIGfhDyEjCyRhJqNEYmqBZW8IlOiXCePn6BwX5hQA
π» Code
π Actual behavior
TypeScript reports the following error:
π Expected behavior
Because
Component
is imported as a type, it should be merged with the variableComponent
without emitting an error.Additional information about the issue
A related issue was recently fixed and discussed in a design meeting.
Fixing the current issue could make TypeScript behavior more consistent.
The text was updated successfully, but these errors were encountered: