Skip to content

Commit

Permalink
fix: add missing password field for ConnectOptions (#280)
Browse files Browse the repository at this point in the history
* fix: add missing `password` field in `ConnectOptions`

* fix the return type of Realm.prototype.define()

Co-authored-by: dengruoqi <[email protected]>
  • Loading branch information
luckydrq and dengruoqi authored Feb 23, 2022
1 parent e82f61f commit cb308ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion test/types/realm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('=> Realm (TypeScript)', function () {

it('can customize attributes with descriptors', async function() {
const { STRING } = realm.DataTypes;
realm.define('User', { name: STRING }, {}, {
const User = realm.define('User', { name: STRING }, {}, {
get name() {
return this.attribute('name').replace(/^([a-z])/, function(m, chr) {
return chr.toUpperCase();
Expand All @@ -32,6 +32,8 @@ describe('=> Realm (TypeScript)', function () {
this.attribute('name', value);
}
});
// User.findOne should exists
assert(User.findOne);
});
});

Expand Down
3 changes: 2 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ export interface ConnectOptions {
host?: string;
port?: number | string;
user?: string;
password?: string;
database: string;
models?: string | (typeof Bone)[];
subclass?: boolean;
Expand Down Expand Up @@ -644,7 +645,7 @@ export default class Realm {
attributes: Record<string, DataTypes<DataType> | AttributeMeta>,
options?: InitOptions,
descriptors?: Record<string, Function>,
): Bone;
): typeof Bone;

raw(sql: string): RawSql;

Expand Down

0 comments on commit cb308ae

Please sign in to comment.