dynamodb-onetable icon indicating copy to clipboard operation
dynamodb-onetable copied to clipboard

dist/mjs/Model.d.ts:43:35 - error TS2552: Cannot find name 'function'. Did you mean 'Function'?

Open cgarethc opened this issue 10 months ago • 1 comments

Describe the bug

When building using tsc I receive this error:

dist/mjs/Model.d.ts:43:35 - error TS2552: Cannot find name 'function'. Did you mean 'Function'?

43     generate?: string | boolean | function
                                     ~~~~~~~~

  node_modules/typescript/lib/lib.es5.d.ts:319:13
    319 declare var Function: FunctionConstructor;
                    ~~~~~~~~
    'Function' is declared here.


Found 1 error in node_modules/dynamodb-onetable/dist/mjs/Model.d.ts:43

To Reproduce

Use this tsconfig.json:

{
  "compilerOptions": {
    "target": "es2016",
    "module": "commonjs",
    "esModuleInterop": true,
    "strict": true,
    "outDir": "dist",
    "sourceMap": true,
    "types": [
      "node",
      "express"
    ],
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules"]
}

Schema:

const schema = {
  version: '1.0.0',
  indexes: {
    primary: { hash: 'pk', sort: 'sk' },
    uidNameIndex: { hash: 'uid', sort: 'recipeName', type: 'global' },
  },
  models: {
    Rating: {
      pk: { type: String, value: 'rating#${id}' },
      sk: { type: String, value: 'rating#${id}' },
      id: { type: String, required: true, generate: 'ulid' },
      uid: { type: String, required: true, index: 'uidNameIndex' },
      recipeName: { type: String, required: true, index: 'uidNameIndex' },
      score: { type: Number, required: true },
      review: { type: String },
    },
  },
};

Steps to reproduce the behavior:

Run tsc

Environment (please complete the following information):

  • OS Mac 15.3.2
  • Node Version v20.9.0
  • OneTable Version 2.7.7
  • TypeScript Version 5.3.2

cgarethc avatar Mar 20 '25 02:03 cgarethc

@cgarethc in your tsconfig

  "compilerOptions": {
    "skipLibCheck": true
  }

aouicher avatar Mar 23 '25 18:03 aouicher