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 strict null checking for common/uri common/map node/pfs and node/glob test #65488

Merged
merged 6 commits into from Dec 20, 2018

Conversation

Projects
None yet
4 participants
@Kermit-Xuan
Copy link
Contributor

Kermit-Xuan commented Dec 20, 2018

#65233

  • "./vs/base/test/node/uri.test.ts"
  • "./vs/base/test/node/map.test.ts"
  • "./vs/base/test/node/pfs.test.ts"
  • "./vs/base/test/node/glob.test.ts"

@Kermit-Xuan Kermit-Xuan changed the title Enable strict null checking for node/pfs and node/glob test Enable strict null checking for common/uri common/map node/pfs and node/glob test Dec 20, 2018

@Kermit-Xuan Kermit-Xuan changed the title Enable strict null checking for common/uri common/map node/pfs and node/glob test Enable strict null checking for node/pfs and node/glob test Dec 20, 2018

@Kermit-Xuan Kermit-Xuan changed the title Enable strict null checking for node/pfs and node/glob test Enable strict null checking for common/uri common/map node/pfs and node/glob test Dec 20, 2018

@bpasero bpasero merged commit 5874ba8 into Microsoft:master Dec 20, 2018

2 checks passed

VS Code #20181220.57 succeeded
Details
license/cla All CLA requirements met.
Details

@bpasero bpasero added this to the December/January 2019 milestone Dec 20, 2018

@@ -588,7 +588,7 @@ suite('Map', () => {
test('mapToSerializable / serializableToMap', function () {
const map = new Map<string, string>();
map.set('1', 'foo');
map.set('2', null);
map.set('2', null!);

This comment has been minimized.

@gaurav5430

gaurav5430 Dec 20, 2018

Contributor

what does null! do? can't seem to wrap my head around it

This comment has been minimized.

@Kermit-Xuan

Kermit-Xuan Dec 20, 2018

Author Contributor

Because of strict-null-check mode, the null and string are not in the domain of the same type. It will throw error when typescript compile with --strictNullChecks. You can know strict-null-check in the Typescript Doc.

This comment has been minimized.

@gaurav5430

gaurav5430 Dec 20, 2018

Contributor

I understand the non null assertion operator generally, for example when used with objects, it indicates to the compiler that we are sure the object is not going to be null even if the compiler can't infer it.
i just don't understand why is it used with null here and what does it mean to the compiler in this case.

We are passing null to something which is not declared as nullable, and cheating the compiler by adding a ! ?

@Kermit-Xuan Kermit-Xuan deleted the Kermit-Xuan:strict-null-check-node branch Dec 20, 2018

@Kermit-Xuan Kermit-Xuan restored the Kermit-Xuan:strict-null-check-node branch Dec 20, 2018

@Kermit-Xuan Kermit-Xuan deleted the Kermit-Xuan:strict-null-check-node branch Dec 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment