MichalLytek / MichalLytek/type-graphql

[Docs] Add installation notice for strict mode

Open Beginner friendly
#645 9 comments 16 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Community :family_man_girl: Discussion :speech_balloon: Documentation :book:
Dominant language
TypeScript
Stars
8.1k
Forks
672
PR merge metrics
No merged PRs in 30d

Description

**Describe the issue**
The installation guide should add a mention that using `strict` type-checking requires making class properties with a `!` or disabling strict checking for property initialization in classes. Elsewise users will face the following error:

> Property 'xy' has no initializer and is not definitely assigned in the constructor

My suggestion (to be added at the end of https://typegraphql.com/docs/installation.html):

> In case of using strict type-checking in `tsconfig.json`, all non-optional class properties are required to use the non-null assertion operator `!`.
>
> As an alternative solution strict checking of property initialization in classes can be disabled:
>
> ```json
> "strictPropertyInitialization": false
> ```

**Are you able to make a PR that fix this?**
I can do if my suggestion is ok.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the installation guide at https://typegraphql.com/docs/installation.html and review its ending. Add a notice explaining the strict type-checking requirement for non-optional class properties and the alternative strictPropertyInitialization setting shown in the issue. Done means the guide clearly presents both options and the reported error is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.