Skip to content

Improve type-compiler handing of extends field in tsconfig #600

Description

@lionelhorn

TLDR : when "extends" is an array in tsconfig, type-compiler crashes.

While using deepkit vite plugin like that

// vite.config.ts

export default defineConfig({
  [...]
    plugins: [
        deepkitType({
            tsConfig: resolve(__dirname, "tsconfig.json"),
            compilerOptions: {
                "sourceMap": true,
            }
        }),
    // [...]
    ],
})

// tsconfig.json

{
    "include": ["**/*.ts", "**/*.tsx"],
    "extends": ["@epic-web/config/typescript"],
    "compilerOptions": {
        "paths": {
            "#app/*": ["./app/*"],
            "#tests/*": ["./tests/*"],
            "@/icon-name": [
                "./app/components/ui/icons/name.d.ts",
                "./types/icon-name.d.ts"
            ]
        }
    },
    "reflection": "true"
}

https://github.com/deepkit/deepkit-framework/blob/1e0d489dfcf5e18cd3903719ce944930ad3c900f/packages/type-compiler/src/config.ts#L289

Will crash with TypeError: The "path" argument must be of type string. Received an instance of Array

According to https://www.typescriptlang.org/tsconfig/#extends it's supposed to be a string.
According to the tsconfig-schema.json and the "intellisense" like highlight in my IDE, it can be array | string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions