Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

So many errors in typescript code #112

Closed
polRk opened this issue Jan 14, 2020 · 8 comments
Closed

So many errors in typescript code #112

polRk opened this issue Jan 14, 2020 · 8 comments

Comments

@polRk
Copy link

polRk commented Jan 14, 2020

After clone, i see many errors and can't build project.

Снимок экрана 2020-01-14 в 12 47 06 PM

I think, you should use eslnit + tsc with right configs.
tsconfig.json

{
  "compilerOptions": {
    "target": "ES2017",
    "module": "commonjs",
    "declaration": true,
    "outDir": "dist",
    "sourceMap": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strictNullChecks": true,
    "noImplicitAny": true,
    "noUnusedLocals": true,
    "lib": ["esnext"]
  },
  "include": ["src/**/*.ts", "tests/**/*.ts"],
  "exclude": ["node_modules"]
}

.eslintrc.js

module.exports = {
  parser: '@typescript-eslint/parser',
  extends: [
    'plugin:@typescript-eslint/recommended',
    'plugin:prettier/recommended',
    'prettier/@typescript-eslint',
  ],
  parserOptions: {
    ecmaVersion: 2018,
    sourceType: 'module',
  },
};
@manast
Copy link
Contributor

manast commented Jan 14, 2020

This seems to be specific to your editor setup, there are no errors as demonstrated by the builds in travis.

@polRk
Copy link
Author

polRk commented Jan 14, 2020

No, it's not all ide setup errors. For example:

My variant ( valid typings )

export class Queue<T = any> extends QueueGetters {
  token = v4();
  limiter?: RateLimiterOptions;
  jobsOpts?: JobsOptions;

Your variant ( invalid typings )

export class Queue<T = any> extends QueueGetters {
  token = v4();
  limiter: RateLimiterOptions = null;
  jobsOpts: JobsOptions;

TS2322: Type 'null' is not assignable to type 'RateLimiterOptions'.

@manast
Copy link
Contributor

manast commented Jan 14, 2020

You are probably compiling with different settings. As you see the library compiles just fine in Travis, otherwise the tests would not pass.

@manast manast closed this as completed Jan 14, 2020
@manast
Copy link
Contributor

manast commented Jan 14, 2020

For the record with latest code in master as now:
image

@polRk
Copy link
Author

polRk commented Jan 14, 2020

You assign variable with type RateLimiterOptions the value null. In my opinion, this is a mistake

@polRk
Copy link
Author

polRk commented Jan 14, 2020

Pls, use RateLimiterOptions | null type. You mislead other developers with your code

@polRk
Copy link
Author

polRk commented Jan 14, 2020

In your typings, limiter - is always exists and can't be null. But it false

@manast
Copy link
Contributor

manast commented Jan 14, 2020

you are welcome to submit a PR and then we can discuss if it can be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants