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

Warning: Condition always false #1394

Closed
AlexZanel opened this issue Sep 2, 2019 · 1 comment · Fixed by #1396
Closed

Warning: Condition always false #1394

AlexZanel opened this issue Sep 2, 2019 · 1 comment · Fixed by #1396

Comments

@AlexZanel
Copy link

I have main tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "allowUnreachableCode":true,
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ],
    "paths": {
      "core": [
        "dist/core"
      ],
      "core/*": [
        "dist/core/*"
      ],
      "@angular/*": [
        "node_modules/@angular/*"
      ],
      "rxjs": [
        "node_modules/rxjs"
      ],
      "rxjs/*": [
        "node_modules/rxjs/*"
      ]
    }
  }
}

and tsconfig.json for my lib

{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "outDir": "../../out-tsc/lib",
    "target": "es2015",
    "module": "es2015",
    "moduleResolution": "node",
    "declaration": true,
    "sourceMap": true,
    "inlineSources": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "types": [
      "jasmine"
    ],
    "lib": [
      "dom",
      "es2018"
    ]
  },
  "angularCompilerOptions": {
    "annotateForClosureCompiler": true,
    "skipTemplateCodegen": true,
    "strictMetadataEmit": true,
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true,
    "enableResourceInlining": true,
    "warnings": false,
  },
  "exclude": [
    "dist",
    "src/test.ts",
    "**/*.spec.ts"
  ]
}

When I build lib I get warning:
WARNING: Condition always false

I have this interfase

export interface IPagination {
  prevUrl?: string;
  selfUrl?: string;
  nextUrl?: string;
  number: number;
  size: number;
  totalElements: number;
  totalPages: number;
}

The following code is generated for this interface

 function IPagination() { }
    if (false) {
        /** @type {?|undefined} */
        IPagination.prototype.prevUrl;
        /** @type {?|undefined} */
        IPagination.prototype.selfUrl;
        /** @type {?|undefined} */
        IPagination.prototype.nextUrl;
        /** @type {?} */
        IPagination.prototype.number;
        /** @type {?} */
        IPagination.prototype.size;
        /** @type {?} */
        IPagination.prototype.totalElements;
        /** @type {?} */
        IPagination.prototype.totalPages;
    }

Why it turns into an impossible condition?
How can I disable this warning or fix this?

@AlexZanel AlexZanel changed the title Werning: Condition always false Warning: Condition always false Sep 2, 2019
alan-agius4 added a commit that referenced this issue Sep 3, 2019
Most of these errors are not actionable as they remove code which was generated by either tsickle of ngc.

Closes: #1177 and closes #1394
alan-agius4 added a commit that referenced this issue Sep 3, 2019
Most of these errors are not actionable as they remove code which was generated by either tsickle of ngc.

Closes: #1177 and closes #1394
@github-actions
Copy link

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
This action has been performed automatically by a bot.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant