c12
c12 copied to clipboard
`extends` isn't typed in `createDefineConfig`
trafficstars
Environment
Node 20.2.0 c12 1.4.1
Reproduction
// my-config.mjs
import { createDefineConfig } from "c12";
export interface MyConfig {
github: {
token: string;
};
}
export const defineConfig = createDefineConfig<MyConfig>();
// Elsewhere:
import { defineConfig } from './my-config.mjs';
export default defineConfig({
extends: ['./example.ts']
});
Describe the bug
Argument of type '{ extends: string[]; github: { token: string; }; }' is not assignable to parameter of type 'InputConfig<MyConfig, ConfigLayerMeta>'.
Object literal may only specify known properties, and 'extends' does not exist in type 'InputConfig<MyConfig, ConfigLayerMeta>'.
Additional context
The only additional types added in are the ones prefixed with $:
extends seems to be the only "system" added key that's not prefixed with $ 🤔
Logs
No response
Hi dear @rijkvanzanten. I know it is a frustrating DX but an intentional behavior because essentially the extends key can be renamed to something else therefore we cannot statically add a built-in type for it. However you can both extend the defined config.