Skip to content

Conversation

fasttime
Copy link
Member

@fasttime fasttime commented Oct 12, 2025

Prerequisites checklist

What is the purpose of this pull request?

Correct several issues with the types for config-array and object-schema.

StackBlitz Repro

What changes did you make? (Give an overview)

Renamed dist/cts/types.ts to dist/cts/types.cts

In both config-array and object-schema, dist/cjs/index.d.cts imports types from "./types.cts", but there is no such module. The corresponding file is named types.ts: https://app.unpkg.com/@eslint/config-array@0.21.0/files/dist/cjs/index.d.cts#L4, https://app.unpkg.com/@eslint/object-schema@2.1.6/files/dist/cjs/index.d.cts#L1-2.

export type ConfigObject = import("./types.cts").ConfigObject;
export type ObjectDefinition = import("./types.cts").ObjectDefinition;
export type PropertyDefinition = import("./types.cts").PropertyDefinition;

To fix this, I've update the Rollup config of both packages to ensure the generated type module in dist/cjs is correctly named types.cts rather than types.ts.

Removed type export for @jsr/std__path:

@jsr/std__path is a dev dependency of config-array. Its types are not visible outside the repo and are not supposed to be exported, as it is currently the case: https://app.unpkg.com/@eslint/config-array@0.21.0/files/dist/esm/index.d.ts#L7.

export type PathImpl = typeof import("@jsr/std__path");

I've converted a @typedef tag into an @import to avoid exporting the types of the @jsr/std__path package.

Removed symbol signature from ConfigArray class

There is an unintentional indexed type with symbol key on the ConfigArray class that is incompatible with the base Array type: https://app.unpkg.com/@eslint/config-array@0.21.0/files/dist/esm/index.d.ts#L14.

    [x: symbol]: (config: any) => any;

I've added a type cast to never on the expressions of the two computed keys to prevent TypeScript from adding the signature.

Excluded std_path from type checking

The files under dist/*/std_path in config-array are extracted from a JSR package during the build. When TypeScript compiles the other sources, it reports several type errors for these files that can be disregarded.

I've updated the Rollup config to add a @ts-nocheck comment to the files in dist/*/std_path.

Added type tests

I've added minimal type tests to config-array and object-schema to catch compiler errors like to ones above. The type export from @jsr/std__path is a special case, because those types are visible throughout the repo and TypeScript only reports an error when the dependency is not found.

Related Issues

Is there anything you'd like reviewers to focus on?

@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Oct 12, 2025
@eslint-github-bot eslint-github-bot bot added the bug Something isn't working label Oct 12, 2025
@fasttime fasttime changed the title fix: fix config-array types fix: fix config-array and object-schema types Oct 12, 2025
@fasttime fasttime force-pushed the fix-config-array-types branch from 0ba5351 to 5678013 Compare October 12, 2025 11:36
@fasttime fasttime marked this pull request as ready for review October 13, 2025 11:03
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

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

1 participant