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

When serving APIs how to get rid of @ts-nocheck #347

Open
eminoklopcic opened this issue Nov 27, 2024 · 3 comments
Open

When serving APIs how to get rid of @ts-nocheck #347

eminoklopcic opened this issue Nov 27, 2024 · 3 comments

Comments

@eminoklopcic
Copy link

Hi together,

since CAP 8 we have to problems that this typeScript code is criticized before that it worked like this, what would be the solution without nocheck. I've putted a sample code for this here

// @ts-nocheck

import { Service } from '@sap/cds';
import { x } from '@;
import { y } from '@';

type ErrorHandler = (error: any, request: any) => Promise<void>;

export class x extends Service {
    static SERVICE_DESCRIPTOR = {
        operationTypeToRequiredScopes: {
            READ: x
        },
    };

    async init() {
        //---------------------------------------------------------------------
        // Generic error message handler
        this.on('error', this.handleError as ErrorHandler);

        return super.init();
    }

    private async handleError(error: any, request: any) {
        await x(
            error,
            request,
           y
        );
    }
}

When we remove nocheck we get this
Property 'on' does not exist on type 'x'.ts(2339)
any

@renejeglinsky
Copy link

Hi @eminoklopcic ,
thanks for opening this issue. IN this repository we only cover documentation related issues. Yours is different. Do you use the @cds-typer package?

@eminoklopcic
Copy link
Author

eminoklopcic commented Nov 27, 2024 via email

@renejeglinsky renejeglinsky transferred this issue from cap-js/docs Nov 27, 2024
@renejeglinsky
Copy link

Maybe it's a duplicate or is related to #318

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