Open PaulMest opened 4 years ago
Hey, could you provide a reproduction repo?
I don't see where the error can come. tableName
is defined in the strategy https://github.com/tonivj5/typeorm-naming-strategies/blob/master/src/snake-naming.strategy.ts#L10 and the strategy is setted into the connection
https://github.com/typeorm/typeorm/blob/master/src/connection/Connection.ts#L130
@PaulMest If you haven't resolved this, it also might be worth checking that you are emitting to es6+ with tsc. es5 and below has quirks with TypeScript and classes annoyingly. Has solved issues not too dissimilar before.
I have the same issue. At first I extended this class (we wanted to have the names in plural) and added the class to my project. everything worked fine.
But then I extracted the class into another package (symlinked via npm install ../path) and ran into this issue.
I thought it myght be a problem with my implementation or typescript configuration, so I downloaded the code and tried it with the repo-content. Still the same problem.
Then I tried to use the package tar from npmjs.com. First I put it next to my project and installed it with npm install ../typeorm-naming-strategies
This created a symlink in test/node_modules.
When I tried to run my code the first time, it came up with this error:
Type 'SnakeNamingStrategy' is missing the following properties from type 'NamingStrategyInterface': closureJunctionTableName, primaryKeyName, uniqueConstraintName, relationConstraintName, and 10 more.
Then I installed the dependencies in typeorm-naming-strategies
The next Error was this:
TypeError: tableOrName.split is not a function
at SnakeNamingStrategy.DefaultNamingStrategy.getTableName (./typeorm-naming-strategies/node_modules/typeorm/naming-strategy/DefaultNamingStrategy.js:20:28)
at SnakeNamingStrategy.DefaultNamingStrategy.primaryKeyName (./typeorm-naming-strategies/node_modules/typeorm/naming-strategy/DefaultNamingStrategy.js:52:30)
at PostgresQueryRunner.createTableSql (./test/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:2754:65)
at PostgresQueryRunner.<anonymous> (./test/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:602:45)
When i deleted the symlink from node_modules and placed a copy of the tar content in node_modules everything worked fine again.
So I think it has something to do with symlinks and typescript and not really with this package, but if you have an idea why this issue occures, it would be very helpful. I think typescript needs to handle the dependencies relative to the folder, where the symlink is placed and not to where the original folder is, but I don't know how to tell typescript this.
If I upgrade TypeORM from
0.2.22
to0.2.26
or0.2.27
I get the following error:... any idea what could be the problem?