Skip to content

Conversation

bananaumai
Copy link
Contributor

@bananaumai bananaumai commented Oct 4, 2020

About

recommend enabling strict mode for avoiding type checking failure when using this library in TypeScript project.

Background

As I mentioned in #135 , I found the circumstance where the type checking for encode/decode function call fails.

That specifically happens when user defined context type is given to the ExtensionCodec.

const extensionCodec = new ExtensionCodec<UserDefinedContext>();

Solution

Set compilerOptions.strictNullChecks to true in tsconfig.json.

Acknowledgement

I'm not so familiar with TypeScript and still don't understand why this issue happens. (I'll follow up this phenomenon for my interest later)

* recommend enabling `strict` mode for avoiding type checking failure
@codecov-commenter
Copy link

codecov-commenter commented Oct 4, 2020

Codecov Report

Merging #136 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #136   +/-   ##
=======================================
  Coverage   98.29%   98.29%           
=======================================
  Files          15       15           
  Lines         936      936           
  Branches      205      205           
=======================================
  Hits          920      920           
  Misses         16       16           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6ed7993...0709254. Read the comment docs.

@gfx
Copy link
Member

gfx commented Oct 4, 2020

Nice catch!

I'm not sure why strictNullChecks to compile, neither. Hopefully, this library works without strictNullChecks, but this explanation should help users for the time being.

@gfx gfx merged commit 9626ff5 into msgpack:master Oct 4, 2020
@bananaumai bananaumai deleted the add-readme-annotation-for-ts branch October 5, 2020 00:17
bananaumai added a commit to bananaumai/msgpack-javascript that referenced this pull request Oct 10, 2020
This commit intends to fix the issue reported on msgpack#136
bananaumai added a commit to bananaumai/msgpack-javascript that referenced this pull request Oct 10, 2020
This commit intends to fix the issue reported on msgpack#136
bananaumai added a commit to bananaumai/msgpack-javascript that referenced this pull request Oct 10, 2020
This commit intends to fix the issue reported on msgpack#136
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.

3 participants