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

Enable strictNullChecks #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

raveclassic
Copy link
Contributor

@raveclassic raveclassic commented Apr 21, 2020

Hi, this PR is a continuation of #76 (fully includes that changes, so #76 should be merged first). This PR enables TS strictNullChecks flag and contains corresponding changes.
There're no breaking changes.

@codecov
Copy link

codecov bot commented Apr 21, 2020

Codecov Report

Merging #77 into master will increase coverage by 0.02%.
The diff coverage is 96.10%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #77      +/-   ##
==========================================
+ Coverage   96.22%   96.24%   +0.02%     
==========================================
  Files          13       13              
  Lines        1508     1517       +9     
  Branches      136      146      +10     
==========================================
+ Hits         1451     1460       +9     
  Misses         57       57              
Impacted Files Coverage Δ
src/testing.ts 96.79% <91.17%> (+0.03%) ⬆️
src/behavior.ts 98.30% <100.00%> (+0.02%) ⬆️
src/common.ts 97.75% <100.00%> (+0.10%) ⬆️
src/datastructures.ts 100.00% <100.00%> (ø)
src/future.ts 96.45% <100.00%> (ø)
src/placeholder.ts 91.13% <100.00%> (ø)
src/stream.ts 95.69% <100.00%> (+0.01%) ⬆️
src/time.ts 100.00% <100.00%> (ø)

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 d37fd70...009c49e. Read the comment docs.

[Symbol.iterator]: generator
};
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this change, what about implementing the linked list as an abstract class called List which Cons and Nil extends? Then the iterator and the isNil property could sit on the abstract class. I also think that would fit better with the rest of the code where we use abstract classes and classes that extend them to represent something like algebraic data types/sum types.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reply. Personally I just use tagged unions and simple constructors to encode ADT in TypeScript because it lets to check such unions exhaustively, sort of exhaustive pattern matching. But I'll check your suggestion, thanks!

Copy link
Contributor Author

@raveclassic raveclassic May 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paldepind Looks like it's impossible to declare Cons using abstract class, because it would require declaring value and tail fields on Nil with some "nully" values to make shared generator work. That would defeat the very purpose of this PR - get rid of such values.
Declaring Cons using tagged union OTOH allows to declare value and tail only when isNil === false (means using isNil as tag).

@raveclassic
Copy link
Contributor Author

raveclassic commented May 9, 2020

Also I don't get why codecov/patch fails, everything is fine on my local machine.
UPD: ahhh, maybe I need to rebase instead of merging
UPD2: nope, didn't help :(

@DSoko2
Copy link

DSoko2 commented Mar 7, 2021

Does it make sense to continue on this? Is the only reason it is not merged yet the 0.12% missing test coverage of the patch? In case, I suggest to append this commit, covering some additional lines: DSoko2@163328b

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