Giter Club home page Giter Club logo

Comments (18)

bytekast avatar bytekast commented on July 21, 2024 1
{
  "compilerOptions": {
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "lib": ["es2020", "dom"],
    "target": "es2020",
    "removeComments": true,
    "moduleResolution": "node",
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "inlineSourceMap": true,
    "inlineSources": true,
    "module": "commonjs",
    "isolatedModules": true,
    "outDir": "./dist",
    "rootDir": "./src",
  },
  "include": ["./**/*.ts"],
  "exclude": ["node_modules/**/*", ".serverless/**/*", ".webpack/**/*", "_warmup/**/*", ".vscode/**/*"]
}

from dynamodb-onetable.

mobsense avatar mobsense commented on July 21, 2024

Can you rename OneTypes to OneType in that file and see if that works?

from dynamodb-onetable.

bytekast avatar bytekast commented on July 21, 2024

changed it. cleaned up a few files. one last error:

node_modules/dynamodb-onetable/dist/cjs/Table.d.ts:21:25 - error TS2314: Generic type 'Model<T>' requires 1 type argument(s).

21     intercept?: (model: Model, op: string, rec: {}, params: OneParams, raw?: {}) => void,
                           ~~~~~

it looks like the type definitions need to be cleaned up

from dynamodb-onetable.

bytekast avatar bytekast commented on July 21, 2024

changed to intercept?: (model: Model<any>, op: string, rec: {}, params: OneParams, raw?: {}) => void, and it compiled

from dynamodb-onetable.

mobsense avatar mobsense commented on July 21, 2024

Cool. Probably should be AnyModel. Can you please try that and then we'll update the NPM.

from dynamodb-onetable.

bytekast avatar bytekast commented on July 21, 2024

yep. AnyModel worked. FYI I also had to remove the trailing ; in the following files Model.d.ts, Table.d.ts

from dynamodb-onetable.

mobsense avatar mobsense commented on July 21, 2024

Great. I don't understand removing the trailing semicolon? Can you explain a bit more? Thanks.

from dynamodb-onetable.

mobsense avatar mobsense commented on July 21, 2024

It seems that type declarations can use either semicolon or comma (or nothing) as a line terminator.

We have some types line OneTableSchema that use commas:

type OneIndexSchema = {
    hash: string,
    sort?: string,
    description?: string,
    follow?: boolean,
}

and others that use semicolon:

export type Entity<T extends OneTypedModel> = {
    [P in keyof T]?: EntityField<T[P]>;
};

I'd like to be consistent. What are the best practices / rules. Comma, semicolon or nothing?

I've read that React may bomb on semicolons inside Interface declarations.

from dynamodb-onetable.

mobsense avatar mobsense commented on July 21, 2024

Background:

https://stackoverflow.com/questions/27994253/why-is-the-separator-in-a-typescript-typememberlist-semicolon-as-opposed-to-comm/27994757#27994757

prettier/prettier#1944

from dynamodb-onetable.

bytekast avatar bytekast commented on July 21, 2024

these are the errors:


node_modules/dynamodb-onetable/dist/cjs/Model.d.ts:188:2 - error TS1036: Statements are not allowed in ambient contexts.

188 };
     ~
node_modules/dynamodb-onetable/dist/cjs/Table.d.ts:57:2 - error TS1036: Statements are not allowed in ambient contexts.

57 };

have no idea why. if i remove the semicolon at the end of the files, it works.

from dynamodb-onetable.

mobsense avatar mobsense commented on July 21, 2024

What version of TSC are you using?

I don't see that with 4.0.3

from dynamodb-onetable.

mobsense avatar mobsense commented on July 21, 2024

And that is complaining only about the very last semicolon in the file but not the ones before that?

from dynamodb-onetable.

bytekast avatar bytekast commented on July 21, 2024

I am at Version 4.1.5. yeah, it doesn't complain about the ones before. just the last one.

from dynamodb-onetable.

mobsense avatar mobsense commented on July 21, 2024

This is our tsconfig we use when testing:

{
    "compilerOptions": {
        "allowJs": true,
        "allowSyntheticDefaultImports": true,
        "baseUrl": "src",
        "declaration": true,
        "esModuleInterop": true,
        "inlineSourceMap": false,
        "lib": ["esnext"],
        "listEmittedFiles": false,
        "listFiles": false,
        "moduleResolution": "node",
        "noFallthroughCasesInSwitch": true,
        "pretty": true,
        "resolveJsonModule": true,
        "rootDir": "src",
        "skipLibCheck": true,
        "strict": true,
        "traceResolution": false
    },
    "compileOnSave": false,
    "exclude": ["node_modules", "dist"],
    "include": ["src"]
}

Can you please share yours and we'll test.

I'm happy with the fix, but I'd like to understand why.

from dynamodb-onetable.

mobsense avatar mobsense commented on July 21, 2024

skipLibCheck in our tsconfig was the culprit.

Sorry, we'll apply the fix. Good to understand why we were not seeing this.

from dynamodb-onetable.

bytekast avatar bytekast commented on July 21, 2024

nice! thanks for validating!

from dynamodb-onetable.

mobsense avatar mobsense commented on July 21, 2024

That has uncovered a few other issues ... :-(

from dynamodb-onetable.

mobsense avatar mobsense commented on July 21, 2024

Thank you for assisting. Appreciated.

from dynamodb-onetable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.