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

Fix TypeScript tests so they fail for errors 😭 #209

Merged
merged 1 commit into from
Feb 13, 2019

Conversation

kumar303
Copy link
Contributor

I noticed that the TypeScript tests aren't working. Here's a patch that should trigger a test failure:

diff --git a/index.d.ts b/index.d.ts
index fa84b3e..b788e7c 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -3,7 +3,7 @@ import { Action, ActionCreator, AnyAction, StoreEnhancer, Store } from 'redux';
 export interface StoreCreator {
   <S, A extends Action>(
     reducer: LoopReducer<S, A>,
-    preloadedState: S | undefined,
+    preloadedState?: S | undefined,
     enhancer: StoreEnhancer<S>
   ): Store<S>;
 }

Only after passing the error to done() (which totally isn't documented correctly), I get a test failure:

 FAIL  test/typescript.spec.js
  ● Console

    console.log node_modules/typescript-definition-tester/dist/index.js:28
      Global finished

  ● TypeScript definitions › should compile against index.d.ts

    AssertionError: Semantic: /Users/kumar/tmp/redux-loop/index.d.ts (7,5): A required parameter cannot follow an optional parameter.

      at diagnostics.forEach.diagnostic (node_modules/typescript-definition-tester/dist/index.js:17:15)
          at Array.forEach (<anonymous>)
      at handleDiagnostics (node_modules/typescript-definition-tester/dist/index.js:14:17)
      at compile (node_modules/typescript-definition-tester/dist/index.js:29:9)
      at walk (node_modules/typescript-definition-tester/dist/index.js:63:13)
      at next (node_modules/typescript-definition-tester/dist/index.js:82:24)
      at node_modules/typescript-definition-tester/dist/index.js:95:21

Test Suites: 1 failed, 7 passed, 8 total

There was an error about some usage of Promise which I fixed with some lib configuration. Unfortunately I couldn't find a way to use tsconfig.json directly.

@bdwain
Copy link
Member

bdwain commented Feb 13, 2019

oof good catch. thanks!

@bdwain bdwain merged commit 5f8ee14 into redux-loop:master Feb 13, 2019
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

Successfully merging this pull request may close these issues.

None yet

2 participants