Skip to content
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

Migrate bundler's codebase to TypeScript #56

Closed
aeworxet opened this issue Sep 12, 2022 · 10 comments · Fixed by #66
Closed

Migrate bundler's codebase to TypeScript #56

aeworxet opened this issue Sep 12, 2022 · 10 comments · Fixed by #66

Comments

@aeworxet
Copy link
Collaborator

@Souvikns states in PR
#46
I also think this would be the right time to move to typescript

I would like to take on this issue also.
@derberg @magicmatatjahu @jonaslagoni, there's a need to decide who of us two will migrate the bundler's codebase to TypeScript.

@github-actions
Copy link

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@magicmatatjahu
Copy link
Member

Awesome! As I know you @aeworxet wanna to do it, so for me you can start from now, but let's wait for @Souvikns opinion whether he would like to do it with you in coop.

@aeworxet
Copy link
Collaborator Author

It would be awesome if PR
#46
is merged, so the code is more up-to-date and ready for immediate action.

@magicmatatjahu
Copy link
Member

⬆️ cc @jonaslagoni

@jonaslagoni
Copy link
Sponsor Member

jonaslagoni commented Sep 12, 2022

I am not a code owner, so it's not my review that's blocking it 😄 ⬆️ cc @derberg

@Souvikns
Copy link
Member

@Souvikns opinion whether he would like to do it with you in coop.

Yeah @aeworxet you can take on the issue, I can help you with anything you need.

@derberg
Copy link
Member

derberg commented Sep 12, 2022

@aeworxet thanks for volunteering 🙇🏼

@aeworxet
Copy link
Collaborator Author

During assignment of TS types to functions' parameters and variables I have run into type errors in parser.ts which can be solved only by maintainers:

$ tsc

src/parser.ts:37:75 - error TS2559: Type '$Refs' has no properties in common with type 'JSONSchema7'.
37             const componentObject = await resolveExternalRefs(JSONSchema, $ref);
                                                                             ~~~~

src/parser.ts:38:28 - error TS2339: Property 'components' does not exist on type 'JSONSchema7'.
38             if (JSONSchema.components) {
                              ~~~~~~~~~~

src/parser.ts:39:34 - error TS2339: Property 'components' does not exist on type 'JSONSchema7'.
39                 merge(JSONSchema.components, componentObject);
                                    ~~~~~~~~~~

src/parser.ts:41:28 - error TS2339: Property 'components' does not exist on type 'JSONSchema7'.
41                 JSONSchema.components = componentObject
                              ~~~~~~~~~~

src/parser.ts:68:98 - error TS7031: Binding element 'parent' implicitly has an 'any' type.
68     JSONPath({ json: parsedJSON, resultType: 'all', path: '$.channels.*.*.message' }).forEach(
  ({ parent, parentProperty }) => {
     ~~~~~~

src/parser.ts:68:106 - error TS7031: Binding element 'parentProperty' implicitly has an 'any' type.
68     JSONPath({ json: parsedJSON, resultType: 'all', path: '$.channels.*.*.message' }).forEach(
  ({ parent, parentProperty }) => {
             ~~~~~~~~~~~~~~

src/parser.ts:71:33 - error TS2339: Property 'get' does not exist on type 'JSONSchema7'.
71             const value = $refs.get(ref);
                                   ~~~

src/parser.ts:73:13 - error TS7053: Element implicitly has an 'any' type because expression of
type 'string' can't be used to index type '{}'.
  No index signature with a parameter of type 'string' was found on type '{}'.
73             componentObj.messages[String(component.getKey())] = component.getValue()
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 8 errors in the same file, starting at: src/parser.ts:37

@Souvikns @magicmatatjahu @derberg

@Souvikns
Copy link
Member

@aeworxet can you open a PR with your current code, I will take a look.

@aeworxet
Copy link
Collaborator Author

PR #66

asyncapi-bot pushed a commit that referenced this issue Oct 10, 2022
Co-authored-by: Matatjahu <urbanczyk.maciej.95@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants