Repository navigation
feat(client): ts-migrate client/src/utils - #42666
Conversation
|
Hey @ojeytonwilliams, I just started migrated my latest batch of files and I'm having some trouble figuring out what the requests in |
raisedadead
left a comment
There was a problem hiding this comment.
We have landed the next branch into main, and I have rebased and retargeted your pull request. Please make sure to sync with your local before you continue to make any further changes.
If you need assistance with that, let us know in the contributors chat, or here.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Looks like everything's synced properly on my end. While I have your ear, could I get some help on migrating |
|
Hey @awu43, sorry for the delay getting back to you.
Unfortunately it's quite complicated since each call fetches a different type of data. They should all be JSON objects, but they will all have different shapes. To figure it out, you can look at the part of the api that handles that endpoint and it should call For example, freeCodeCamp/api-server/src/server/boot/user.js Lines 75 to 91 in 3d7ee4c So we expect to receive an object with the keys I hope that clarifies a touch and wasn't just telling you what you already know! |
|
No worries @ojeytonwilliams, I'm sure everybody was busy trying to unfreeze things. Your advice has definitely helped and after poking around in |
ShaunSHamilton
left a comment
There was a problem hiding this comment.
As mentioned, there needs to be a good reason to assert the type with as - only when the compiler cannot infer the type. As it stands, the assertion is giving the incorrect type.
ojeytonwilliams
left a comment
There was a problem hiding this comment.
Hi @awu43 as I've been looking into this, I've come to realise that most of the error code is legacy and can be removed. Once we've done that all the Axios stuff should go away again.
Since this is kind of out of scope for this PR, don't worry about it, I'll handle it after merging.
However, in order to do that, could you revert the migration of client/src/utils/format.js? Unfortunately this is used by the curriculum and the curriculum is not able to handle TypeScript yet. I'd rather not pull on that particular thread until we have to!
That would explain how I broke the imports without renaming it. It's been done. |
ojeytonwilliams
left a comment
There was a problem hiding this comment.
Awesome job @awu43! LGTM 👍
caf4102
raisedadead
left a comment
There was a problem hiding this comment.
@ojeytonwilliams can you confirm we are going to need axios in the client and there is no way around it..
ojeytonwilliams
left a comment
There was a problem hiding this comment.
@raisedadead it's all good, axios is only used in tests and doesn't make its way into any bundles:

|
@awu43 Thanks again for this excellent PR 💯 |
This reverts commit e1d8f4b.
Checklist:
Update index.md)mainbranch of freeCodeCamp.Refers #42256
Files:
Issues:
ajax.tswith a grain of salt. While I've done my best to follow the breadcrumbs to deduce the proper types, there was some guesswork involved.