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

Does not compile in TypeScript with strict flag enabled #448

Closed
michaeljota opened this issue Dec 27, 2017 · 5 comments
Closed

Does not compile in TypeScript with strict flag enabled #448

michaeljota opened this issue Dec 27, 2017 · 5 comments
Labels

Comments

@michaeljota
Copy link

Case

  • Bug

Issue

If try to compile a project with rxdb as dependency with strict flag enable, the TypeScript compiler complains about several implicit any types.

ERROR in node_modules/rxdb/src/typings/index.d.ts(75,5): error TS7008: Member 'create' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(76,5): error TS7008: Member 'removeDatabase' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(77,5): error TS7008: Member 'plugin' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(78,5): error TS7008: Member 'RxPlugin' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(81,5): error TS7008: Member 'isRxDatabase' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(82,5): error TS7008: Member 'RxDatabaseCreator' implicitly has an 'any' type.node_modules/rxdb/src/typings/index.d.ts(83,5): error TS7008: Member 'RxDatabase' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(86,5): error TS7008: Member 'isRxCollection' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(87,5): error TS7008: Member 'RxCollectionCreator' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(88,5): error TS7008: Member 'RxCollection' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(91,5): error TS7008: Member 'isRxDocument' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(92,5): error TS7008: Member 'RxDocument' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(95,5): error TS7008: Member 'isRxQuery' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(96,5): error TS7008: Member 'RxQuery' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(99,5): error TS7008: Member 'RxAttachment' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(102,5): error TS7008: Member 'isRxSchema' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(103,5): error TS7008: Member 'RxSchema' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(104,5): error TS7008: Member 'RxJsonSchema' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(107,5): error TS7008: Member 'PouchDB' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(108,5): error TS7008: Member 'QueryChangeDetector' implicitly has an 'any' type.
node_modules/rxdb/src/typings/index.d.ts(109,5): error TS7008: Member 'RxError' implicitly has an 'any' type.
node_modules/rxdb/src/typings/rx-document.d.ts(36,19): error TS7006: Parameter 'RxAttachmentCreator' implicitly has an 'any' type.

Info

  • Environment: Compiler

Code

// index.ts
import rxdb from 'rxdb';
// tsconfig.json
{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "strict": true
  }
}

Run the TS compiler npx tsc.

@pubkey
Copy link
Owner

pubkey commented Dec 29, 2017

I added strict: true to our typings-tests. But everything seems to works fine. Which typescript-version do you have?

@michaeljota
Copy link
Author

I test it with 2.6 and with 2.7-dev(@next tag)

pubkey added a commit that referenced this issue Dec 29, 2017
@pubkey pubkey closed this as completed in 245413c Dec 30, 2017
@pubkey
Copy link
Owner

pubkey commented Dec 30, 2017

I could reproduce and fix this now.
Please notice that there is still an rxjs-issue with the strict-mode. See here

@anidotnet
Copy link

anidotnet commented Sep 19, 2018

I am still having the same issue with rxdb@8.0.0. Here is the error saying:

> tsc

node_modules/rxdb/typings/rx-database.d.ts:74:12 - error TS7006: Parameter 'ServerOptions' implicitly has an 'any' type.

74     server(ServerOptions?): {
              ~~~~~~~~~~~~~~

node_modules/rxdb/typings/rx-document.d.ts:19:54 - error TS7006: Parameter 'RxDocumentType' implicitly has an 'any' type.

19 declare type AtomicUpdateFunction<RxDocumentType> = (RxDocumentType) => RxDocumentType | Promise<RxDocumentType>;
                                                        ~~~~~~~~~~~~~~

Here is my tsconfig

{
  "compilerOptions": {
    "target": "es5",
    "lib": [ "es2015", "dom" ],
    "module": "commonjs",
    "declaration": true,
    "outDir": "./lib",
    "strict": true
  },
  "include": ["src"],
  "exclude": ["node_modules", "**/__tests__/*"]
}

@pubkey
Copy link
Owner

pubkey commented Sep 19, 2018

@anidotnet thanks for reporting.
I now enabled the strict-mode in the angular-example to ensure this will not happen again in the future but instead fail on the CI when something is wrong.

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

No branches or pull requests

3 participants