analytics.js-core
analytics.js-core copied to clipboard
[TypeScript] explicitly defines call patterns for page method
I noticed that the type for page previously required all arguments, but this doesn't match the behavior described in the tests or the library itself.
I made what is here by looking at the tests (and not the library source code) because I had quite a hard time thinking through all the combinations the library source code allows (and, after all, the tests already seem to have done that).
should be all set. I will note that calling with just name is, now, the only way to call page this without a callback. Is that correct or is the callback (as a last argument) always optional?
@dimitropoulos Ah, the callback is always optional. We'll definitely want the types to reflect that. From our docs
An optional function that is executed after a short timeout, giving the browser time to make outbound requests first.
This is true for any type of call (Track, Identity, etc)