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.

Class extends value undefined is not a constructor or null

See original GitHub issue

When importing casbin in a typescript project for Angular I get this error: image

For the Model class I’ve solved by importing like this:

import { Model } from "casbin/lib/esm/model";

But for newEnforcer there is no way to work around that issue. Am I missing something?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:26 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
nodececommented, Aug 22, 2021

Hello @giovanni-bertoncelli, casbin.js@next has been released on NPM, you can use yarn add casbin.js@next or npm install casbin.js@next --save to add this to your project, how to use:

import { newEnforcer, newModel, MemoryAdapter } from 'casbin.js';

const model = newModel(`
[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

[role_definition]
g = _, _

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
`);

const adapter = new MemoryAdapter(`
p, alice, data1, read
p, bob, data2, write
p, data2_admin, data2, read
p, data2_admin, data2, write

g, alice, data2_admin
`);


const enforcer = await newEnforcer(model, adapter);
1reaction
giovanni-bertoncellicommented, Aug 19, 2021

Maybe this can be a valid alternative: https://www.papaparse.com/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Class extends value undefined is not a function or null - Stack ...
I am getting the following error when trying to create these entities. TypeError: Class extends value undefined is ...
Read more >
Class extends value undefined is not a constructor or null in ...
Describe the bug On using 3.53.0 version of "@aws-sdk/client-*" packages, we are getting the following error on running our tests: ...
Read more >
TypeError: Class extends value undefined is not a ... - Drupal
Initial searching seems to imply that this indicates an issue with a circular dependency. Might have to be a separate issue, but there...
Read more >
typeerror: class extends value undefined is not a ... - You.com
TypeError : Class extends value undefined is not a function or null. Start > Run > AppWiz.cpl > Uninstall node.js. Delete the node...
Read more >
TypeError: Class extends value undefined is not a constructor ...
[moved to issue] Tutorial problem: TypeError: Class extends value undefined is not a constructor or null - Get Help and Help Others -...
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