Skip to content

Bug: typeChecker.getProgram is not a function #14

@Lookwe69

Description

@Lookwe69

When i run typePaserPlugin i have this error stack :

> @gac/gac-ui@4.1.4 make-metadata
> node ./scripts/make-metadata.js --outdir dist

file:///var/app/node_modules/@custom-elements-manifest/analyzer/src/utils/index.js:69
    throw new Error(`\n\n[${name ?? 'unnamed-plugin'}]: ${errorMessage}\n\n ${e.stack}\n`);
          ^

Error: 

[type-parser-plugin]: Looks like you've hit an error in third party plugin: type-parser-plugin. Please try to create a minimal reproduction and inform the author of the type-parser-plugin plugin.

 TypeError: typeChecker.getProgram is not a function
    at getParsedType (file:///var/app/node_modules/@wc-toolkit/type-parser/dist/index.js:152:36)
    at file:///var/app/node_modules/@wc-toolkit/type-parser/dist/index.js:168:107
    at Array.map (<anonymous>)
    at getUnionTypes (file:///var/app/node_modules/@wc-toolkit/type-parser/dist/index.js:168:93)
    at getParsedType (file:///var/app/node_modules/@wc-toolkit/type-parser/dist/index.js:137:12)
    at getTypeValue (file:///var/app/node_modules/@wc-toolkit/type-parser/dist/index.js:359:12)
    at file:///var/app/node_modules/@wc-toolkit/type-parser/dist/index.js:387:23
    at Array.forEach (<anonymous>)
    at updateParsedTypes (file:///var/app/node_modules/@wc-toolkit/type-parser/dist/index.js:386:16)
    at analyzePhase (file:///var/app/node_modules/@wc-toolkit/type-parser/dist/index.js:339:3)

    at withErrorHandling (file:///var/app/node_modules/@custom-elements-manifest/analyzer/src/utils/index.js:69:11)
    at file:///var/app/node_modules/@custom-elements-manifest/analyzer/src/create.js:110:7
    at Array.forEach (<anonymous>)
    at visitNode (file:///var/app/node_modules/@custom-elements-manifest/analyzer/src/create.js:109:19)
    at visitNodes (/var/app/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/lib/typescript.js:28321:24)
    at forEachChildInSourceFile (/var/app/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/lib/typescript.js:28964:18)
    at Object.forEachChild (/var/app/node_modules/@custom-elements-manifest/analyzer/node_modules/typescript/lib/typescript.js:28406:37)
    at visitNode (file:///var/app/node_modules/@custom-elements-manifest/analyzer/src/create.js:115:8)
    at analyze (file:///var/app/node_modules/@custom-elements-manifest/analyzer/src/create.js:106:3)
    at file:///var/app/node_modules/@custom-elements-manifest/analyzer/src/create.js:57:5

Node.js v22.16.0
node:internal/errors:983
  const err = new Error(message);
              ^

Error: Command failed: cem analyze --litelement --outdir "dist"
    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:882:11)
    at execSync (node:child_process:954:15)
    at file:///var/app/scripts/make-metadata.js:10:1
    at ModuleJob.run (node:internal/modules/esm/module_job:274:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 799,
  stdout: null,
  stderr: null
}

Node.js v22.16.0

It used to work on previous version. My cem config:

export default {
	outdir,
	globs: ['src/**/*.ts'],
	exclude: ['**/*.test.ts', '**/testing/**/*'],
	overrideModuleCreation({ ts, globs }) {
		const program = getTsProgram(ts, globs, 'tsconfig.json');
		return program.getSourceFiles().filter((sf) => globs.find((glob) => sf.fileName.includes(glob)));
	},
	plugins: [
		typeParserPlugin(),
	],
};

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