-
Notifications
You must be signed in to change notification settings - Fork 69
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
fix: add two type definitions to SCM and fix their parameters #189
Conversation
It seems that `tsc` doesn't recognize when a class or function has a single `options` parameter that is required but properties within it are not. This corrects the output from `tsc` type definition generation and adds the two files affected by this to repo. Fixes: cloudevents#188 Signed-off-by: Lance Ball <lball@redhat.com>
This is certainly one solution. Thanks for trying to get the types in here! However I think a more elegant solution would just be to not create new files ( I think we can all agree that we shouldn't include generated files in source control. |
Thanks for the feedback. Can you put together a PR that illustrates what you are talking about and perhaps uses an interface to address it? |
I'd imagine something like this: constructor(cloudEvent: CloudEventV1 = SPEC_V1) {
...
} In a The source for Unfortunately I don't think we can add optional types without changing the extension or manually creating types as suggested in this PR. I'd rather rename the file extension as generated-then-hand-modified files are hard to keep up-to-date. |
@grant if you can put together a PR for that I would appreciate it. I think that will be easiest for me to understand how it all fits together, and to experiment with it from both a pure JS project and a pure TS project. |
I'm happy to put a PR together if it will be accepted. However, I don't know if you understand what I'm suggesting. This would be my 3rd attempt at introducing From a technical standpoint, I would like to ensure we understand:
If we are not happy with those understandings, I can't see a technical way to solve this problem and can't contribute. if we're OK with that, I am free Friday to collaborate and put a PR together. |
Yes I think this could be ok. I am not too concerned about the filename changes. I don’t love the continuous I meant what I said when I said #155 could be the start of a gradual movement towards TS. And I admit that this comes from ignorance on my part. But I don’t think that I would have been able to get a 2.0 release out as quickly as I did if I had to also be learning the machinations of typescript in the meantime. I’m happy to start making that journey right now. |
Hey Lance, I'll try to answer some of the questions.
OK. Yeah it's sorta bothersome in the beginning, but it's really lightweight and provides a pretty good devX imo.
So, right now we are generating A TypeScript It affects the SDK code writing When we publish the npm module, we publish our code which has a
It doesn't affect the pure JS end developer. Pure JS developers do however often use editors like VS Code that provides inference via TS. TypeScript does not attempt to force the JS world to type TypeScript, it's strictly optional because it is a strict language superset.
Great. It's fine to have everyone learn and contribute to the project with their own perspectives and requirements.
Great to hear. |
Closing in favor of #194 |
It seems that
tsc
doesn't recognize when a class or function has a singleoptions
parameter that is required but properties within it are not.This corrects the output from
tsc
type definition generation and addsthe two files affected by this to repo.
This might not be the best way to go, but it is a quick fix that we should at least discuss.
Fixes: #188