Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Instanceof check fails #34

Open
AlexanderVishnevsky opened this issue Oct 1, 2020 · 1 comment
Open

[BUG]: Instanceof check fails #34

AlexanderVishnevsky opened this issue Oct 1, 2020 · 1 comment

Comments

@AlexanderVishnevsky
Copy link

Hi there, I'm trying to check if type, but got the following error:
"TypeError: Right-hand side of 'instanceof' is not an object"

Code sample:

cloudConfig
    .load(springCloudServerConfig)
    .then((config: Config | Error) => {
        if (config instanceof Config) {
            console.log(config.get('server.port'));
}}).catch((e) => console.error('SpringCloudConfig Error', e));
@pods13
Copy link

pods13 commented Nov 21, 2024

@AlexanderVishnevsky just check that config is definied, i.e. if(config){console.log(config.get(...))} or you can also check that config is an object, i.e if(typeof config ==='object')
instance probably does not work because Config is an abstract class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants