Skip to content

JSON imported with import type treated as valueΒ #63659

Description

@ysulyma

πŸ”Ž Search Terms

"import type", "resolveJsonModule", "import json"

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about import type

⏯ Playground Link

can't provide playground link due to #63658

πŸ’» Code

import type T from "./translations.json";

export function getTranslations() {
	return {} as T;
}

πŸ™ Actual behavior

Error on line 4:

'T' refers to a value, but is being used as a type here. Did you mean 'typeof T'? [2749]

πŸ™‚ Expected behavior

T should be treated as a type since it was imported with import type

Additional information about the issue

To reproduce this issue you must set "resolveJsonModule": true in tsconfig.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions