Skip to content

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

Open
@lionelhorn

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"
}

const path = join(basePath, currentConfig.extends);

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions