You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an export isn't a function then the error message is a bit ugly at build-time:
~/code/telefunc/examples/vite (brillout/dev*|u+2) pnpm run build
> @ build /home/rom/code/telefunc/examples/vite
> vite build && vite build --ssr
vite v4.3.9 building for production...
✓ 30 modules transformed.
dist/client/index.html 0.15 kB │ gzip: 0.14 kB
dist/client/assets/index-0ace5282.js 8.95 kB │ gzip: 3.69 kB
✓ built in 236ms
vite v4.3.9 building SSR bundle for production...
✓ 3 modules transformed.
dist/server/package.json 0.02 kB
dist/server/assets/hello.telefunc-d5e7aa62.js 0.61 kB
dist/server/entry.js 0.62 kB
telefunc v0.1.84 shield() generation
✓ shield() generated for the telefunctions hello() (hello.telefunc.ts)
TypeScript project /home/rom/code/telefunc/examples/vite/tsconfig.json errors:
__telefunc_shieldGen_hello.telefunc.ts:5:60 - error TS2344: Type 'number' does not satisfy the constraint '(...args: any) => any'.
5 type someNonFunctionExportShield = ShieldArrStr<Parameters<typeof someNonFunctionExport>>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hello.telefunc.ts:14:24 - error TS2345: Argument of type '({ name }: { name: string; }) => Promise<{ message: string; }>' is not assignable to parameter of type 'Telefunction'.
Types of parameters '__0' and 'args' are incompatible.
Type 'unknown' is not assignable to type '{ name: string; }'.
14 __decorateTelefunction(someFunc, "hello", "/hello.telefunc.ts", "/home/rom/code/telefunc/examples/vite", true);
~~~~~~~~
hello.telefunc.ts:15:24 - error TS2345: Argument of type 'number' is not assignable to parameter of type 'Telefunction'.
15 __decorateTelefunction(someNonFunctionExport, "someNonFunctionExport", "/hello.telefunc.ts", "/home/rom/code/telefunc/examples/vite", true);
~~~~~~~~~~~~~~~~~~~~~
../../node_modules/.pnpm/@[email protected]/node_modules/@types/mdx/index.d.ts:66:58 - error TS2503: Cannot find namespace 'JSX'.
66 export default function MDXContent(props: MDXProps): JSX.Element;
~~~
../../node_modules/.pnpm/@[email protected]/node_modules/@types/mdx/types.d.ts:4:51 - error TS2503: Cannot find namespace 'JSX'.
4 type FunctionComponent<Props> = (props: Props) => JSX.Element;
~~~
../../node_modules/.pnpm/@[email protected]/node_modules/@types/mdx/types.d.ts:6:52 - error TS2503: Cannot find namespace 'JSX'.
6 type ClassComponent<Props> = new (props: Props) => JSX.ElementClass;
~~~
../../node_modules/.pnpm/@[email protected]/node_modules/@types/mdx/types.d.ts:11:65 - error TS2503: Cannot find namespace 'JSX'.
11 [key: string]: NestedMDXComponents | Component<any> | keyof JSX.IntrinsicElements;
~~~
../../node_modules/.pnpm/@[email protected]/node_modules/@types/mdx/types.d.ts:23:23 - error TS2503: Cannot find namespace 'JSX'.
23 [Key in keyof JSX.IntrinsicElements]?: Component<JSX.IntrinsicElements[Key]> | keyof JSX.IntrinsicElements;
~~~
../../node_modules/.pnpm/@[email protected]/node_modules/@types/mdx/types.d.ts:23:58 - error TS2503: Cannot find namespace 'JSX'.
23 [Key in keyof JSX.IntrinsicElements]?: Component<JSX.IntrinsicElements[Key]> | keyof JSX.IntrinsicElements;
~~~
../../node_modules/.pnpm/@[email protected]/node_modules/@types/mdx/types.d.ts:23:94 - error TS2503: Cannot find namespace 'JSX'.
23 [Key in keyof JSX.IntrinsicElements]?: Component<JSX.IntrinsicElements[Key]> | keyof JSX.IntrinsicElements;
~~~
../../node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/index.d.ts:784:22 - error TS2420: Class 'import("/home/rom/code/telefunc/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/index").FSWatcher' incorrectly implements interface 'import("fs").FSWatcher'.
Type 'FSWatcher' is missing the following properties from type 'FSWatcher': ref, unref
784 export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
~~~~~~~~~
[[email protected]][Warning] Failed to generate shield() for telefunction someNonFunctionExport() (hello.telefunc.ts). TypeScript errors (printed above) can be problematic for shield() generation. Fix your TypeScript errors and try again. See https://telefunc.com/shield#typescript-automatic for more information.
✓ built in 6.72s
We could use ts-morph to check whether all exports are functions but it isn't trivial. The code removed here which did that wasn't exhaustive as attested by the failing CI of this change. See also: #141.
The text was updated successfully, but these errors were encountered:
When an export isn't a function then the error message is a bit ugly at build-time:
We could use
ts-morph
to check whether all exports are functions but it isn't trivial. The code removed here which did that wasn't exhaustive as attested by the failing CI of this change. See also: #141.The text was updated successfully, but these errors were encountered: