Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"npx auto info" failing with "Failed to compile TypeScript: Debug Failure" using auto.config.ts file #2248

Open
danawoodman opened this issue Aug 17, 2022 · 7 comments · May be fixed by #2401
Labels
bug Something isn't working

Comments

@danawoodman
Copy link

danawoodman commented Aug 17, 2022

Describe the bug

Getting the following error when running npx auto info:

TypeScriptCompileError: Failed to compile TypeScript: Debug Failure. False expression: Non-string value passed to 	`ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature.

To Reproduce

Setup auto in an existing project via the instructions in the docs, then create a TypeScript config file:

auto.config.ts:

import { AutoRc } from "auto";

export default function rc(): AutoRc {
	return {};
}

Using .auto with this works:

{}

Expected behavior

Should output info about auto

Screenshots

Environment information:

"auto" version: v10.37.4
"git"  version: v2.32.0 (Apple Git-132)
"node" version: v17.9.1

Additional context

Full stack trace:

TypeScriptCompileError: Failed to compile TypeScript: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.
    at Function.TypeScriptCompileError.fromError (/path/to/my/repo/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/src/Errors/TypeScriptCompileError.ts:20:12)
    at /path/to/my/repo/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/src/index.ts:14:34
    at Generator.next (<anonymous>)
    at /path/to/my/repo/node_modules/tslib/tslib.js:118:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/path/to/my/repo/node_modules/tslib/tslib.js:114:16)
    at loader (/path/to/my/repo/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/src/index.ts:6:51)
    at Explorer.loadFileContent (/path/to/my/repo/node_modules/cosmiconfig/src/Explorer.ts:81:32)
    at Explorer.createCosmiconfigResult (/path/to/my/repo/node_modules/cosmiconfig/src/Explorer.ts:89:36)
    at Explorer.loadSearchPlace (/path/to/my/repo/node_modules/cosmiconfig/src/Explorer.ts:65:31)

@SeanKeenan-at
Copy link

Apparently upgrading ts-node will fix this issue.

@domoritz
Copy link
Contributor

domoritz commented Sep 20, 2022

Well, I hoped it would fix the issue but I ams till getting the same build failure in https://github.com/vega/ts-json-schema-generator/actions/runs/3048721411/jobs/4914094811. This is still a bug, I think.

@hydrosquall
Copy link
Contributor

I think the issue is that a dependency of @auto-it/core is using an old (2+) version of this library which can't go above version 9.x .

"@endemolshinegroup/cosmiconfig-typescript-loader": "^3.0.2",

If we were to upgrade the loader to https://github.com/Codex-/cosmiconfig-typescript-loader (which sets ts-node as a peer instead of direct dependency )

The other workaround we're trying in the meantime is to use a JSON file instead of a TS file for configuring auto so that the the old loader code doesn't need to run at all. vega/ts-json-schema-generator#1413

@domoritz
Copy link
Contributor

Looks like there even is a pull request: EndemolShineGroup/cosmiconfig-typescript-loader#215 but no updates. Maybe auto needs to use a different library that is more maintained.

@MikeMatusz
Copy link

Also had to stop using the TS config due to this, which is a shame since having typings available was really nice. Looks like that library was archived October 2, 2022. The cosmiconfig README recommends a fork of that as a replacement: https://github.com/codex-/cosmiconfig-typescript-loader

@hipstersmoothie
Copy link
Collaborator

hipstersmoothie commented Sep 14, 2023 via email

@MikeMatusz
Copy link

Yeah, looks like a pretty straightforward replacement. I think I can find some time in the next week or so to get a PR up.

@MikeMatusz MikeMatusz linked a pull request Sep 19, 2023 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants