Skip to content

[Bug]: TypeScript >= 5.5 - "Error: target is a string value" #94

@rpearce

Description

@rpearce

Hi!

When trying to upgrade an OSS package of mine from typescript@5.4.5 to @5.5.3, I ran into an error seeming to come from this package.

Expand to see error
Error: target is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram
    at Object.createProgram (/<REDACTED>/node_modules/typescript/lib/typescript.js:123997:15)
    at <anonymous> (/<REDACTED>/node_modules/@storybook/react-docgen-typescript-plugin/src/plugin.ts:248:32)

The error appears to be coming from

const tsProgram = ts.createProgram(
modulesToProcess.map(([name]) => name),
compilerOptions
);

It looks like this is the same issue as in nuxt/module-builder#299 that was fixed in https://github.com/unjs/mkdist/pull/224/files by using ts.convertCompilerOptionsFromJson(...).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions