Skip to content

4.16.x cannot wrap $extend in factory function when compilerOptions.composite is true #19866

@awinograd

Description

@awinograd

Bug description

I'm trying to upgrade to 4.16.x and use the GA version of client extensions. However, now when I try to export my extended client from a file I get the following typescript error.

Return type of exported function has or is using name 'PrismaPromise_2' from external module "node_modules/.prisma/client/runtime/index" but cannot be named. (tsserver 4023)

How to reproduce

  1. clone https://github.com/awinograd/prisma-repro/tree/aw/extend
  2. yarn tsc --build --force
✘ ⮀ prisma-repro ⮀ ⭠ aw/extend± ⮀ yarn tsc --build --force
yarn run v1.22.15
$ /Users/awinograd/programming/prisma-repro/node_modules/.bin/tsc --build --force
script.ts:3:17 - error TS4058: Return type of exported function has or is using name 'PrismaPromise_2' from external module "/Users/awinograd/programming/prisma-repro/node_modules/@prisma/client/runtime/index" but cannot be named.

3 export function getDbClient(options: Prisma.PrismaClientOptions) {
                  ~~~~~~~~~~~

script.ts:3:17 - error TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.

3 export function getDbClient(options: Prisma.PrismaClientOptions) {
                  ~~~~~~~~~~~


Found 2 errors.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected behavior

extended client can be exported without a TS error

Environment & setup

  • OS: macOS
  • Database: PostgreSQL
  • Node.js version: 16.13.1

Prisma Version

prisma                  : 4.16.0
@prisma/client          : 4.16.0
Current platform        : darwin-arm64
Query Engine (Node-API) : libquery-engine b20ead4d3ab9e78ac112966e242ded703f4a052c (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Migration Engine        : migration-engine-cli b20ead4d3ab9e78ac112966e242ded703f4a052c (at node_modules/@prisma/engines/migration-engine-darwin-arm64)
Format Wasm             : @prisma/prisma-fmt-wasm 4.16.0-66.b20ead4d3ab9e78ac112966e242ded703f4a052c
Default Engines Hash    : b20ead4d3ab9e78ac112966e242ded703f4a052c
Studio                  : 0.484.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions