Skip to content

Commit

Permalink
fix(client): prefix clients with Prisma__. Closes prisma/prisma-cli…
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Jun 19, 2020
1 parent a00fdf7 commit 06dcf5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/packages/client/src/generation/TSClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,13 @@ ${actionName}<T extends ${getModelArgName(name, actionName)}>(
)}, 'select' | 'include'>): Promise<number>
}
export declare class ${name}Client<T> implements Promise<T> {
/**
* The delegate class that acts as a "Promise-like" for ${name}.
* Why is this prefixed with \`Prisma__\`?
* Because we want to prevent naming conflicts as mentioned in
* https://github.com/prisma/prisma-client-js/issues/707
*/
export declare class Prisma__${name}Client<T> implements Promise<T> {
private readonly _dmmf;
private readonly _fetcher;
private readonly _queryType;
Expand Down
4 changes: 2 additions & 2 deletions src/packages/client/src/generation/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ export function getSelectReturnType({
)}<T>${listClose}${promiseClose}>`
}

return `CheckSelect<T, ${name}Client<${getType(name, isList)}${
return `CheckSelect<T, Prisma__${name}Client<${getType(name, isList)}${
actionName === 'findOne' ? ' | null' : ''
}>, ${name}Client<${getType(getPayloadName(name) + '<T>', isList)}${
}>, Prisma__${name}Client<${getType(getPayloadName(name) + '<T>', isList)}${
actionName === 'findOne' ? ' | null' : ''
}>>`
}
Expand Down

0 comments on commit 06dcf5f

Please sign in to comment.