@trpc/client
Advanced tools
Comparing version 11.0.0-alpha-tmp-issues-6374.696 to 11.0.0-alpha-tmp-issues-6374.697
{ | ||
"bundleSize": 66295, | ||
"bundleOrigSize": 83878, | ||
"bundleReduction": 20.96, | ||
"bundleSize": 66394, | ||
"bundleOrigSize": 84055, | ||
"bundleReduction": 21.01, | ||
"modules": [ | ||
@@ -16,3 +16,3 @@ { | ||
"dependents": [], | ||
"percent": 27.18, | ||
"percent": 27.13, | ||
"reduction": 10.3 | ||
@@ -29,3 +29,3 @@ }, | ||
"dependents": [], | ||
"percent": 11.75, | ||
"percent": 11.73, | ||
"reduction": 0 | ||
@@ -42,3 +42,3 @@ }, | ||
"dependents": [], | ||
"percent": 9.06, | ||
"percent": 9.05, | ||
"reduction": 4.42 | ||
@@ -55,3 +55,3 @@ }, | ||
"dependents": [], | ||
"percent": 8.44, | ||
"percent": 8.43, | ||
"reduction": 19.44 | ||
@@ -71,3 +71,3 @@ }, | ||
], | ||
"percent": 6.16, | ||
"percent": 6.15, | ||
"reduction": 5.64 | ||
@@ -84,3 +84,3 @@ }, | ||
"dependents": [], | ||
"percent": 5.94, | ||
"percent": 5.93, | ||
"reduction": 5.59 | ||
@@ -108,3 +108,3 @@ }, | ||
], | ||
"percent": 5.57, | ||
"percent": 5.56, | ||
"reduction": 37.14 | ||
@@ -114,4 +114,4 @@ }, | ||
"id": "/src/internals/TRPCUntypedClient.ts", | ||
"size": 3289, | ||
"origSize": 4742, | ||
"size": 3295, | ||
"origSize": 4748, | ||
"renderedExports": [ | ||
@@ -127,3 +127,3 @@ "TRPCUntypedClient", | ||
"percent": 4.96, | ||
"reduction": 30.64 | ||
"reduction": 30.6 | ||
}, | ||
@@ -139,3 +139,3 @@ { | ||
"dependents": [], | ||
"percent": 4.8, | ||
"percent": 4.79, | ||
"reduction": 14.24 | ||
@@ -172,3 +172,3 @@ }, | ||
"dependents": [], | ||
"percent": 3.31, | ||
"percent": 3.3, | ||
"reduction": 18.8 | ||
@@ -178,4 +178,4 @@ }, | ||
"id": "/src/createTRPCClient.ts", | ||
"size": 1322, | ||
"origSize": 5233, | ||
"size": 1415, | ||
"origSize": 5404, | ||
"renderedExports": [ | ||
@@ -191,4 +191,4 @@ "clientCallTypeToProcedureType", | ||
], | ||
"percent": 1.99, | ||
"reduction": 74.74 | ||
"percent": 2.13, | ||
"reduction": 73.82 | ||
}, | ||
@@ -265,3 +265,3 @@ { | ||
], | ||
"percent": 0.65, | ||
"percent": 0.64, | ||
"reduction": 33.54 | ||
@@ -268,0 +268,0 @@ }, |
@@ -5,12 +5,13 @@ import type { Unsubscribable } from '@trpc/server/observable'; | ||
import type { TRPCSubscriptionObserver, UntypedClientProperties } from './internals/TRPCUntypedClient'; | ||
import { TRPCUntypedClient, untypedClientSymbol } from './internals/TRPCUntypedClient'; | ||
import { TRPCUntypedClient } from './internals/TRPCUntypedClient'; | ||
import type { TRPCClientError } from './TRPCClientError'; | ||
/** | ||
* @internal | ||
*/ | ||
declare const trpcClientSymbol: unique symbol; | ||
/** | ||
* @public | ||
*/ | ||
export type TRPCClient<TRouter extends AnyRouter> = DecoratedProcedureRecord<TRouter, TRouter['_def']['record']> & { | ||
[untypedClientSymbol]: TRPCUntypedClient<{ | ||
errorShape: TRouter['_def']['_config']['$types']['errorShape']; | ||
transformer: TRouter['_def']['_config']['$types']['transformer']; | ||
}>; | ||
[trpcClientSymbol]: true; | ||
}; | ||
@@ -17,0 +18,0 @@ /** |
@@ -44,6 +44,7 @@ 'use strict'; | ||
*/ function getUntypedClient(client) { | ||
if (client instanceof TRPCUntypedClient.TRPCUntypedClient) { | ||
return client; | ||
// Note: don't use `instanceof TRPCUntypedClient` as it won't work if @trpc/client isn't hoisted | ||
if (client[TRPCUntypedClient.untypedClientSymbol]) { | ||
return client[TRPCUntypedClient.untypedClientSymbol]; | ||
} | ||
return client[TRPCUntypedClient.untypedClientSymbol]; | ||
return client; | ||
} | ||
@@ -50,0 +51,0 @@ |
@@ -41,3 +41,3 @@ import type { Unsubscribable } from '@trpc/server/observable'; | ||
} | ||
export declare const untypedClientSymbol: unique symbol; | ||
export declare const untypedClientSymbol = "__internal_untypedClient"; | ||
//# sourceMappingURL=TRPCUntypedClient.d.ts.map |
@@ -115,5 +115,5 @@ 'use strict'; | ||
} | ||
const untypedClientSymbol = Symbol('TRPCClient'); | ||
const untypedClientSymbol = '__internal_untypedClient'; | ||
exports.TRPCUntypedClient = TRPCUntypedClient; | ||
exports.untypedClientSymbol = untypedClientSymbol; |
{ | ||
"name": "@trpc/client", | ||
"version": "11.0.0-alpha-tmp-issues-6374.696+c944cfbf2", | ||
"version": "11.0.0-alpha-tmp-issues-6374.697+41465ba29", | ||
"description": "The tRPC client library", | ||
@@ -80,7 +80,7 @@ "author": "KATT", | ||
"peerDependencies": { | ||
"@trpc/server": "11.0.0-alpha-tmp-issues-6374.696+c944cfbf2", | ||
"@trpc/server": "11.0.0-alpha-tmp-issues-6374.697+41465ba29", | ||
"typescript": ">=5.7.2" | ||
}, | ||
"devDependencies": { | ||
"@trpc/server": "11.0.0-alpha-tmp-issues-6374.696+c944cfbf2", | ||
"@trpc/server": "11.0.0-alpha-tmp-issues-6374.697+41465ba29", | ||
"@types/isomorphic-fetch": "^0.0.39", | ||
@@ -103,3 +103,3 @@ "@types/node": "^22.9.0", | ||
], | ||
"gitHead": "c944cfbf28c0723b087dfd4b2d26c554457374f0" | ||
"gitHead": "41465ba29ad50fa0a28146f8d8fb85cde796c562" | ||
} |
@@ -30,2 +30,7 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ | ||
/** | ||
* @internal | ||
*/ | ||
const trpcClientSymbol = Symbol(); | ||
/** | ||
* @public | ||
@@ -37,6 +42,3 @@ */ | ||
> & { | ||
[untypedClientSymbol]: TRPCUntypedClient<{ | ||
errorShape: TRouter['_def']['_config']['$types']['errorShape']; | ||
transformer: TRouter['_def']['_config']['$types']['transformer']; | ||
}>; | ||
[trpcClientSymbol]: true; | ||
}; | ||
@@ -191,6 +193,10 @@ | ||
}> { | ||
if (client instanceof TRPCUntypedClient) { | ||
return client; | ||
// Note: don't use `instanceof TRPCUntypedClient` as it won't work if @trpc/client isn't hoisted | ||
if ((client as any)[untypedClientSymbol]) { | ||
return (client as any)[untypedClientSymbol]; | ||
} | ||
return client[untypedClientSymbol]; | ||
return client as TRPCUntypedClient<{ | ||
errorShape: TRouter['_def']['_config']['$types']['errorShape']; | ||
transformer: TRouter['_def']['_config']['$types']['transformer']; | ||
}>; | ||
} |
@@ -176,2 +176,2 @@ import type { | ||
export const untypedClientSymbol = Symbol('TRPCClient'); | ||
export const untypedClientSymbol = '__internal_untypedClient'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
309136
8057