Skip to content

verbatim-module-syntax should not fix by adding type keyword to import decl with named and default imports #1382

@dsherret

Description

@dsherret

Given:

import React, { useState } from 'react';
useState(true);
export type Test = React;

This is wrong:

import type React, { useState } from 'react';
useState(true);
export type Test = React;
error: TS1363 [ERROR]: A type-only import can specify a default import or named bindings, but not both.
import type React, { useRef, useState } from "react";
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///home/runner/work/ts-ast-viewer/ts-ast-viewer/src/components/Options.tsx:1:[8](https://github.com/dsherret/ts-ast-viewer/actions/runs/12549999832/job/34992017213?pr=163#step:7:9)

This is right:

import type React from "react";
import { useState } from 'react';
useState(true);
export type Test = React;

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