Skip to content

Plain eval is used without transpilation. Ts handlers do not work #19

@Archer-Lotos

Description

@Archer-Lotos

Describe the bug

Plain eval is used without transpilation:

const fn = memoEval(code);

Example Of Non-Working Typescript Handler

Handler Code

import { DeepClient } from "@deep-foundation/deeplinks/imports/client.js";
import { Link } from "@deep-foundation/deeplinks/imports/minilinks.js";
import { DeepClientInstance } from "@deep-foundation/deeplinks/imports/client";

async (options: {
  deep: DeepClient;
  data: {
    newLink: Link<number>;
  };
}) => {
    return 5
};

Error

{
  "stack": "SyntaxError: Cannot use import statement outside a module\n    at eval (<anonymous>)\n    at memoized (/node_modules/lodash/memoize.js:62:23)\n    at makeFunction (file:///index.js:29:16)\n    at file:///index.js:61:20\n    at Generator.next (<anonymous>)\n    at file:///index.js:7:71\n    at new Promise (<anonymous>)\n    at __awaiter (file:///index.js:3:12)\n    at file:///index.js:56:33\n    at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)",
  "message": "Cannot use import statement outside a module"
}

Expected Behavior

No response

Current Behavior

No response

Steps to reproduce

No response

Environment

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions