8000 docs: add missing `declare` keywords to relationships · adonisjs/lucid.adonisjs.com@f604282 · GitHub
[go: up one dir, main page]

Skip to content

Commit f604282

Browse files
McSneakyRomainLanz
authored andcommitted
docs: add missing declare keywords to relationships
1 parent 4a1e2da commit f604282

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

content/docs/models/relationships.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ By default, the `foreignKey` is the **snake_case representation of the parent mo
8282
@hasOne(() => Profile, {
8383
foreignKey: 'profileUserId', // defaults to userId
8484
})
85-
profile: HasOne<typeof Profile>
85+
declare profile: HasOne<typeof Profile>
8686
```
8787

8888
:::note
@@ -95,7 +95,7 @@ The local key is always the **primary key of the parent model** but can also be
9595
@hasOne(() => Profile, {
9696
localKey: 'uuid', // defaults to id
9797
})
98-
profile: HasOne<typeof Profile>
98+
declare profile: HasOne<typeof Profile>
9999
```
100100

101101
## HasMany
@@ -178,7 +178,7 @@ By default, the `foreignKey` is the **camelCase representation of the parent mod
178178
@hasMany(() => Post, {
179179
foreignKey: 'authorId', // defaults to userId
180180
})
181-
posts: HasMany<typeof Post>
181+
declare posts: HasMany<typeof Post>
182182
```
183183

184184
:::note
@@ -191,7 +191,7 @@ The local key is always the **primary key of the parent model** but can also be
191191
@hasMany(() => Post, {
192192
localKey: 'uuid', // defaults to id
193193
})
194-
posts: HasMany<typeof Post>
194+
declare posts: HasMany<typeof Post>
195195
```
196196

197197
## BelongsTo
@@ -342,7 +342,7 @@ A manyToMany relation relies on many different keys to properly set up the relat
342342
relatedKey: 'id',
343343
pivotRelatedForeignKey: 'skill_id',
344344
})
345-
skills: ManyToMany<typeof Skill>
345+
declare skills: ManyToMany<typeof Skill>
346346
```
347347

348348
:::note
@@ -357,7 +357,7 @@ The default value for the pivot table name is computed by [combining](https://gi
357357
@manyToMany(() => Skill, {
358358
pivotTable: 'user_skills',
359359
})
360-
skills: ManyToMany<typeof Skill>
360+
declare skills: ManyToMany<typeof Skill>
361361
```
362362

363363
### Additional pivot columns
@@ -370,7 +370,7 @@ You will have to inform a manyToMany relationship about this extra column. Other
370370
@manyToMany(() => Skill, {
371371
pivotColumns: ['proficiency'],
372372
})
373-
skills: ManyToMany<typeof Skill>
373+
declare skills: ManyToMany<typeof Skill>
374374
```
375375

376376
### Pivot table timestamps
@@ -384,7 +384,7 @@ You can enable the support for **created at** and **updated at** timestamps for
384384
@manyToMany(() => Skill, {
385385
pivotTimestamps: true
386386
})
387-
skills: ManyToMany<typeof Skill>
387+
declare skills: ManyToMany<typeof Skill>
388388
```
389389

390390
Settings `pivotTimestamps = true` assumes the column names are defined as `created_at` and `updated_at`. However, you can define custom column names as well.
@@ -396,7 +396,7 @@ Settings `pivotTimestamps = true` assumes the column names are defined as `creat
396396
updatedAt: 'updation_date'
397397
}
398398
})
399-
skills: ManyToMany<typeof Skill>
399+
declare skills: ManyToMany<typeof Skill>
400400
```
401401

402402
To disable a particular timestamp, you can set its value to `false`.

0 commit comments

Comments
 (0)
0