loopbackio / loopbackio/loopback-next

loopback-datasource-juggler datasource definition for setup method is missing

Open
#7,115 4 comments 0 reactions 1 assignee Claimed by @achrinza View on GitHub
bug
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

## Steps to reproduce
At https://github.com/strongloop/loopback-datasource-juggler/blob/master/types/datasource.d.ts,
there is no definition for method setup, which is defined at:
https://github.com/strongloop/loopback-datasource-juggler/blob/06428247ad1cc48bce82d135f795fb3eaae28b33/lib/datasource.js#L382

1. I create custom datasource `class MyDataSource which extends juggler.Datasource`.
2. I create method setup inside class MyDataSource .
3. I can not use: `super.setup()` inside method setup.

## Current Behavior
When I want to use `super.setup()`, there will be ts error: **Property 'setup' does not exists on type 'Datasource'.**
![Selection_161](https://user-images.githubusercontent.com/5786692/109259886-add2c700-782f-11eb-9a03-5fd84c91c9f1.png)

## Expected Behavior
No ts error when I want to use `super.setup()` inside setup method on my custom datasource class.

## Additional information
Setup method definition:
```
/**
* Setup datasource
* @param dsName The name of the datasource.
* @param settings The datasource settings
*/
setup(dsName: string, settings: Options): void;
setup(settings: Options): void;
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.