Skip to content

Feature request: stronger typing for .betterer.ts exports #1220

@thislooksfun

Description

@thislooksfun

I just found this project and it sounds awesome, but one feature that is missing for me is a strongly-typed .betterer.ts file. It would be awesome if you could expose the BettererTestMap type somehow. Either directly and we can use it to enforce the export structure, or via something like a typed identity bettererConfig function (name not final). For example see how vite does strongly typed config.

Basically what I'm proposing is adding:

export type BettererConfig = BettererTestMap;
// AND / OR
export type { BettererTestMap };
// AND / OR
export function bettererConfig(tests: BettererTestMap): BettererTestMap {
  return tests;
}

That way we could write our .betterer.ts files as:

export default bettererConfig({
  'test name': () => someTest(),
});

// OR

export default {
  'test name': () => someTest(),
} satisfies BettererConfig;

// OR (for js)

/** @type {import('@betterer/betterer').BettererConfig} */
export default {
  'test name': () => someTest(),
};

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