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

why it is not strict ? #15

Open
paolog22 opened this issue Dec 1, 2020 · 8 comments
Open

why it is not strict ? #15

paolog22 opened this issue Dec 1, 2020 · 8 comments

Comments

@paolog22
Copy link

paolog22 commented Dec 1, 2020

can someone please explain why is it not strict thanks

@chouglesaud
Copy link

@paolog22 what do you mean by ''why is it not strict thanks"

@Meskat
Copy link

Meskat commented Dec 1, 2020

are you talking about the TypeScript setting??

@paolog22
Copy link
Author

paolog22 commented Dec 1, 2020

@Meskat yes. when i try making it strict it produces a lot of errors .. @chouglesaud

@chouglesaud
Copy link

chouglesaud commented Dec 1, 2020

The strict flag enables a wide range of type checking behavior that results in stronger guarantees of program correctness.

https://www.typescriptlang.org/tsconfig#strict

@paolog22

@paolog22
Copy link
Author

paolog22 commented Dec 1, 2020

@chouglesaud i know. but why the code is not ? sorry i am just trying to understand what is behind it .

@chouglesaud
Copy link

chouglesaud commented Dec 1, 2020

but why the code is not

can you give an example so I can understand?

strict: true will enable all type checking rule like following

  • strictNullChecks
  • alwaysStrict
  • ...

for example
if you set strictNullChecks to false typescript will just ignore the type checking for variable whether it is null or undefined. on the other hand, if you set to true then it will throw errors.

there is a simple example given in doc's checkout

@chouglesaud
Copy link

chouglesaud commented Dec 1, 2020

sorry i am just trying to understand what is behind it

everybody here is to learn and understand. I am not professional I just knew a little bit and you @paolog22 help me revising the topic.

@DadouBordeaux
Copy link

Hi there,

I had a typing problem on my project, here's and sample from the file AfterUserCreated :

    DomainEvents.register(this.onUserCreatedEvent.bind(this), UserCreatedEvent.name);
  }

Turn out that when enabling strict mode, the compiler complains with  Property 'user' is missing in type 'IDomainEvent' but required in type 'UserCreatedEvent'.

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

No branches or pull requests

4 participants