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

strictNullChecks must be false #894

Open
niroboo opened this issue Nov 6, 2023 · 0 comments
Open

strictNullChecks must be false #894

niroboo opened this issue Nov 6, 2023 · 0 comments

Comments

@niroboo
Copy link

niroboo commented Nov 6, 2023

I'm submitting an undocumented expectation for strictNullChecks to be false.


[ ] Regression 
[x] Bug report
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

After creating a new nest project and setting up azure-database with the default setup and following the azure-database documentation, we run into the following error:

src/contact/contact.service.ts:9:6 - error TS1239: Unable to resolve signature of parameter decorator when called as an expression.
  Argument of type 'undefined' is not assignable to parameter of type 'string | symbol'.

9     @InjectRepository(Contact)
       ~~~~~~~~~~~~~~~~~~~~~~~~~

This line seems to throw an error:

8   constructor(
9     @InjectRepository(Contact)
10    private readonly contactRepository: Repository<Contact>,
11  ) {}

When updating the tsconfig.json to strictNullChecks to false, the samples work now.

Expected behavior

Either the documentation should state that strictNullChecks must be set to false, or preferably the library should work with strictNullChecks set to true.

Minimal reproduction of the problem with instructions

Creating a new nest project and setting up azure-database with the default setup.

$ npm i -g @nestjs/cli
$ nest new project-name
$ cd project-name/
$ npm i --save @nestjs/azure-database

Then set up the sample following the documentation.

What is the motivation / use case for changing the behavior?

It took a while to figure out the null checks were the issue.

Environment

default nest tsconfig.json:

{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "ES2021",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "skipLibCheck": true,
    "strictNullChecks": true,
    "noImplicitAny": true,
    "strictBindCallApply": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true
  }
}

Nest version: 10.0.0

 
For Tooling issues:
- Node version: v18.16.1
- Platform:  Mac
@nestjs nestjs locked and limited conversation to collaborators Nov 8, 2023
@kamilmysliwiec kamilmysliwiec reopened this Nov 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants