Skip to content

strictNullChecks must be false #894

@niroboo

Description

@niroboo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions