Skip to content

Commit ba8806f

Browse files
committed
Pass parameters to create function to recreate issue
1 parent a012b6a commit ba8806f

2 files changed

Lines changed: 43 additions & 29 deletions

File tree

src/test.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ class AdminLogEntity {
1010
public username?: string;
1111
}
1212

13+
interface AdminLogSaveParams {
14+
username?: string,
15+
}
16+
1317
async function main() {
1418
await mongoose.connect(`mongodb://localhost:27017/`, {
1519
dbName: 'verifyMASTER',
@@ -19,11 +23,24 @@ async function main() {
1923
const adminLogModel: ReturnModelType<typeof AdminLogEntity, BeAnObject> = getModelForClass(AdminLogEntity);
2024
const options: mongoose.CreateOptions = { session };
2125

22-
const adminLogEntity = await adminLogModel.create({}, options);
26+
const params = {
27+
username: 'a',
28+
}
29+
30+
const params2: AdminLogSaveParams = {
31+
username: 'b',
32+
}
33+
34+
const adminLogEntity = await adminLogModel.create(params, options);
35+
const adminLogEntity2 = await adminLogModel.create(params2, options);
36+
const adminLogEntity3 = await adminLogModel.create({ username: 'a' }, options);
2337

2438
console.log('entity', adminLogEntity);
39+
console.log('entity2', adminLogEntity2);
40+
console.log('entity3', adminLogEntity3);
2541

2642
await mongoose.disconnect();
2743
}
2844

2945
main();
46+

tsconfig.json

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
11
{
2-
"compileOnSave": true,
3-
"typeAcquisition": {
4-
"enable": true
5-
},
6-
"compilerOptions": {
7-
"experimentalDecorators": true,
8-
"emitDecoratorMetadata": true,
9-
"declarationMap": true,
10-
"outDir": "lib",
11-
"moduleResolution": "node",
12-
"target": "ES2021",
13-
"module": "commonjs",
14-
"newLine": "LF",
15-
"sourceMap": true,
16-
"removeComments": true,
17-
"strict": true,
18-
"allowUnreachableCode": false,
19-
"pretty": true,
20-
"declaration": true,
21-
"incremental": true,
22-
"tsBuildInfoFile": ".tsbuildinfo",
23-
"lib": [
24-
"esnext"
25-
]
26-
},
27-
"include": [
28-
"src/**/*"
29-
]
2+
"compileOnSave": true,
3+
"typeAcquisition": {
4+
"enable": true
5+
},
6+
"compilerOptions": {
7+
"experimentalDecorators": true,
8+
"emitDecoratorMetadata": true,
9+
"declarationMap": true,
10+
"outDir": "lib",
11+
"moduleResolution": "node",
12+
"target": "ES2021",
13+
"module": "commonjs",
14+
"newLine": "LF",
15+
"sourceMap": true,
16+
"removeComments": true,
17+
"strict": true,
18+
"strictPropertyInitialization": false,
19+
"allowUnreachableCode": false,
20+
"pretty": true,
21+
"declaration": true,
22+
"incremental": true,
23+
"tsBuildInfoFile": ".tsbuildinfo",
24+
"lib": ["esnext"]
25+
},
26+
"include": ["src/**/*"]
3027
}

0 commit comments

Comments
 (0)