Redefining method on a type included in a dependent package

I have a package in c3customer called myPackage. In my package.json, I’ve included the following dependent package:

"dependencies": [
  "basePackage"
]

There is a type in basePackage called BaseType that I would like to modify in myPackage.
Specifically, I want to change the implementation of a method defined on BaseType in the BaseType.js file. Ideally, I will not make changes directly within basePackage and instead modify the definitions in myPackage.

Is there a way to do this? Adding BaseType.c3typ and BaseType.js with the modified method implementation has not caused any problems, but the method definition included in MyPackage doesn’t appear to be used when calling it in the environment. This is the (provisionable) file structure I currently have.

c3customer
  basePackage
    src
      BaseType.c3typ
      BaseType.js
  myPackage
    src
      BaseType.c3typ
      BaseType.js
    package.json

Server version is 7.8.8

What does your myPackage/src/BaseType.c3typ file look like? Is it remixing BaseType and declaring the function correctly?

They are declared identically in both myPackage and basePackage.

remix type BaseType { 
  method: ~js server
}

Not sure if it is relevant, but they are both remixing BaseType which is defined in c3base.

That should work. Double check that your BaseType.js file is declaring the method correctly, and also check for any provisioning warnings.

Thanks, it worked! However, I had to do some combination of reprovisioning with -r and restarting my local c3 server until the correct function got called - it seemed to call an older version of the function when I did not do these things first. Is this expected behavior?

Great! No, that’s not expected behavior. If you can come up with steps to reproduce the issue, please do so and file a ticket :pray: