Intellisence support for Mocha and Typescript/Javacript

I have following code: 

import {  Shop, VoucherTestData } from '../types/types';
import voucherActions from '../actions/common/voucher-actions';
import { CheckoutActionsCats } from '../actions/cats/checkout-actions';
import { CheckoutActionsDogs } from '../actions/dogs/checkout-actions';
import { CheckoutActions } from '../actions/common/checkout-actions';

interface VoucherTestData {
shop: string;
checkoutActions: CheckoutActions;
}

export function testVoucher(data: VoucherTestData) {
  context(`${data.shop}`, function () {

    beforeEach(function () {
      this.checkoutActions =
        data.shop === Shop.CATS ? <CheckoutActionsCats>data.checkoutActions : <CheckoutActionsDogs>data.checkoutActions;
    });

    describe('Redeem voucher as a guest user', function () {
      it('I can redeem valid voucher', function () {
        this.checkoutActions.landOnCheckoutPageAsGuest(checkoutGuestModel);
        voucherActions.saveCheckoutPricesBeforeApplyingVoucher();
        voucherActions.redeemVoucher(voucher, true, loc);
        voucherActions.verifyVoucherApplied(voucher);
        this.checkoutActions.finalizeOrder(loc.checkout.orderNowText);
        this.checkoutActions.verifyCheckoutThankYouPage(loc.checkout.thankYouMessage);
      });
    });
  });
}

I an using Mocha, Typescript and Cypress.

When I do CTRL + mouse click on  this.checkoutActions.landOnCheckoutPageAsGuest(checkoutGuestModel);

I don't get any method definition intellisence - it says "Cannot find declaration to go to". I would expect it can offer me two implementations  => one from CheckoutActionsCats and one from CheckoutActionsDogs.

CheckoutActionsCats extends CheckoutActions and CheckoutActionsDogs also extends CheckoutActions.

Why is its acting like this? Is there any way to fix it?

Thanks! 

1 comment
Comment actions Permalink

Please could you share a full, self-containing code snippet (or a set of files) the issue can be repeated with?

0

Please sign in to leave a comment.