question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug with import in Nestjs

See original GitHub issue

Hello, @stalniy. You library is very rich and interesting and I wanna use it in my project, but I faced a strange problem i cannot bypass

Describe the bug After installation and an attempt to import “defineAbility” from the library multiple errors in console apperar

To Reproduce Steps to reproduce the behavior:

import { defineAbility } from '@casl/ability';

My tsconfig.file:

{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es2017",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "esModuleInterop": true
  },
  "exclude": ["node_modules", "dist"]
}

Expected behavior When I run my project with nest start --watch, i encounter such errors:

` backend_1 | node_modules/@casl/ability/dist/types/matchers/conditions.d.ts:35:13 - error TS1005: ‘;’ expected. backend_1 | backend_1 | 35 export type { MongoQueryFieldOperators, MongoQueryTopLevelOperators, MongoQueryOperators, } from ‘@ucast/mongo2js’; backend_1 | ~ backend_1 | backend_1 | node_modules/@casl/ability/dist/types/matchers/conditions.d.ts:35:91 - error TS1109: Expression expected. backend_1 | backend_1 | 35 export type { MongoQueryFieldOperators, MongoQueryTopLevelOperators, MongoQueryOperators, } from ‘@ucast/mongo2js’; backend_1 | ~ backend_1 | backend_1 | node_modules/@casl/ability/dist/types/matchers/conditions.d.ts:35:98 - error TS1005: ‘;’ expected. backend_1 | backend_1 | 35 export type { MongoQueryFieldOperators, MongoQueryTopLevelOperators, MongoQueryOperators, } from ‘@ucast/mongo2js’; backend_1 | ~~~~~~~~~~~~~~~~~ backend_1 | backend_1 | node_modules/@casl/ability/dist/types/types.d.ts:1:13 - error TS1005: ‘=’ expected. backend_1 | backend_1 | 1 import type { Condition } from ‘@ucast/mongo2js’; backend_1 | ~ backend_1 | backend_1 | node_modules/@casl/ability/dist/types/types.d.ts:1:32 - error TS1005: ‘;’ expected. backend_1 | backend_1 | 1 import type { Condition } from ‘@ucast/mongo2js’; backend_1 | ~~~~~~~~~~~~~~~~~ backend_1 | backend_1 | node_modules/@ucast/js/dist/types/index.d.ts:4:1 - error TS1128: Declaration or statement expected. backend_1 | backend_1 | 4 export type { JsInterpretationOptions, JsInterpreter } from ‘./types’; backend_1 | ~~~~~~ backend_1 | backend_1 | node_modules/@ucast/js/dist/types/index.d.ts:4:13 - error TS1005: ‘;’ expected. backend_1 | backend_1 | 4 export type { JsInterpretationOptions, JsInterpreter } from ‘./types’; backend_1 | ~ backend_1 | backend_1 | node_modules/@ucast/js/dist/types/index.d.ts:4:61 - error TS1005: ‘;’ expected. backend_1 | backend_1 | 4 export type { JsInterpretationOptions, JsInterpreter } from ‘./types’; backend_1 | ~~~~~~~~~ backend_1 | backend_1 | [10:30:15 AM] Found 16 errors. Watching for file changes.

`

Interactive example (optional, but highly desirable) provide a link to the example from http://repl.it/, https://codesandbox.io/ or similar, so we can quickly test and provide feedback. Otherwise

CASL Version

@casl/ability - “^5.1.2”

Environment:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Dandzi92commented, Jan 12, 2021

Which ts version do you use?

“typescript”: “3.7.4”

0reactions
Dandzi92commented, Jan 13, 2021

yes, i tried also on boilerplate nest project where current typescript version is “3.9.7” and everything ok. I updated my project and problem is gone. Thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Relative import #1025 - nestjs/nest - GitHub
Why Nest.JS doesn't support relative import? When I run yarn dev , nodaemon find easily all the dependencies with the relative import.
Read more >
Common errors - FAQ - A progressive Node.js framework
During your development with NestJS, you may encounter various errors as you ... A common case would be a module file declaring a...
Read more >
vsCode dependencies bug with nestJs - node.js
vsCode doesn't recognize import { TypeOrmModule } from '@nestjs/typeorm'; as long as I don't restart the ide. Any ideas ?
Read more >
nestjs-hot-shots - npm
Start using nestjs-hot-shots in your project by running `npm i ... import { Module } from '@nestjs/common' import { HotShotsModule } from ...
Read more >
nest can't resolve dependencies of the httpservice - You.com
javascript import { Module, HttpService, HttpModule } from '@nestjs/common'; import { AppController } from './app.controller'; import { AppService } from '.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found