admin管理员组

文章数量:1287285

I'm working on a CDK project using TS. I'm relatively new to TS development. I wonder what's the best way to share my generated types from the GraphQL schema so that I can access them from my Lambdas.

I tried tsconfig.pahts, but it's pretty cumbersome. I've read about Lambda layers, but seem to be problematic as well. My current approach is to deploy everything to the Lambda (which isn't ideal either, but at least is easy to understand):

    // Lambda: ProductList
    this.productListLambda = new lambda.Function(this, "ProductListLambda", {
      runtime: lambda.Runtime.NODEJS_LATEST,
      handler: "lib/lambda/productList/productList.handler",
      code: lambda.Code.fromAsset(path.join(__dirname, "../dist")),
      environment: {
        PRODUCT_LIST_TABLE: props.productListTable.tableName,
      },
    });

My types are located at /lib/graphql/generated

本文标签: typescriptCDK and TS Share types between GraphQL and LambdaStack Overflow