Replies: 5 comments 5 replies
-
CustomEvent is a built-in native code and the The Perhaps the best way to go around this would be to create and use a different event name with an object instead of the ranges (we could add the |
Beta Was this translation helpful? Give feedback.
-
Thanks, didn't know about CustomEvent. I'll use that method to pass the additional vars. Sorry to keep bugging you, but I'm trying to get the project running again in Visual Studio. To rule out issues with my changes I've gone back to the vanilla Firrstly, it appears that you are using VS Code, which is quite a different beast to VS. If it's too difficult to adapt to full VS, I guess I can just VS Code just for this project. But it would be great to use VS because I use it for 100% of my projects. It looks like the build process has changed, because now when I build I get:
Also in VS I get as the one and only error, I suspect masking other errors:
(there is a tsconfig file in the parent folder but not e2e) I was able to overcome a number of other errors by updating npm and adding the cypress-real-events package, but I'm stumped by these. Or perhaps I'm just being an idiot. Not at all familiar with npm or any of the ts or build tools. Any ideas? |
Beta Was this translation helpful? Give feedback.
-
Me again, different but related issue. I'm starting to convert my projects to Typescript. At present they are all old style js - no modules, IIFE all the way. I'm wanting to convert one subsystem at a time to TS and leave the rest as-is, so the two have to co-exist.
This is acceptable and working fine in development, but now I'm facing the issue of what to do in production. I've used the VS 'bundler and minifier' plugin for years, but I don't think it is module-aware. Could you give me a pointer regarding what you see as the best module-aware bundling tool? I read a lot about WebPack, but the module landscape has shifted and evolved rapidly over the last 8 or so years, and I'm not sure, without a lot of research, that it's actually the best, or even suitable at this time. Any hints? |
Beta Was this translation helpful? Give feedback.
-
Thanks, good advice. I am doing both - libraries and I want to convert my page scripts to TS as well, which will require a separate per-page ts/js file. |
Beta Was this translation helpful? Give feedback.
-
Great. Well, my endpoint is a website, so Vite it is. Thanks again. |
Beta Was this translation helpful? Give feedback.
-
Hey @ghiscoding, I have a question. I'm inplementing a few new features and want to refactor some of the basic events in the system. But I'm still a TypeScript newb and struggling a bit. eg. in the RowSelection plugin,
I'd like to add the
selectionMode
parameter to theonSelectedRangesChanged
call. The most obvious way to do this is to change the_ranges
parameter to an object, likeBecause this is a breaking change, we'd need a little code shim at the receiving end of the event to detect whether the parameter was a ranges array or the parameter object, and make sure the result was consistent in both cases (probably transform it to the object form).
From what I can see you have already encountered this situation, and chosen a different approach: to create a custom event and pass the additional data inside that. I've looked over the solution, but I can't find a definition for
CustomEvent
.Could you advise
(1) where is the definition for
CustomEvent
or how does this work? If I was to use it, I'm nor sure where to put the new value, it could be{ detail: { caller, selectionMode } }
or{ detail: { caller }, selectionMode: selectionMode }
and I'm not sure whycaller
is wrapped in its own object and doesn't have a property name.(2) would you object to just moving back to regular event and refactoring the event receiver as described above? I feel like that's much clearer and I can't really think of a downside.
Beta Was this translation helpful? Give feedback.
All reactions