Thanks for the most helpful write up.
Would it be possible to put your full code somewhere please?
I don't know TypeScript and I tried to make the above code work by first following freecodecamp.org/news/learn-typesc...
However, this is what I get when run tsc index.ts:
tsc index.ts
index.ts:21:1 - error TS1434: Unexpected keyword or identifier. 21 async uploadProfilePicture(req, res): Promise<string> { ~~~~~ index.ts:21:37 - error TS1005: ';' expected. 21 async uploadProfilePicture(req, res): Promise<string> { ~ index.ts:22:9 - error TS1005: ':' expected. 22 const binaryData = req.file.buffer ~~~~~~~~~~ index.ts:23:3 - error TS1005: ',' expected. 23 const result = await uploadPicture(binaryData) // Watch below for details ~~~~~ index.ts:23:9 - error TS1005: ':' expected. 23 const result = await uploadPicture(binaryData) // Watch below for details ~~~~~~ index.ts:24:3 - error TS1005: ',' expected. 24 return result.url ~~~~~~ index.ts:24:10 - error TS1005: ':' expected. 24 return result.url ~~~~~~ index.ts:32:22 - error TS1005: ',' expected. 32 uploadPicture(content: Buffer): Promise<object> { ~ index.ts:32:31 - error TS1005: ';' expected. 32 uploadPicture(content: Buffer): Promise<object> { ~ index.ts:33:10 - error TS1005: ':' expected. 33 return new Promise((resolve, reject) => {
My use case is written in Typescript, but the equivalent can be done with standard Javascript.
If a corresponding standard Javascript version could also be provided, that'd be more appreciated.
Thanks!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for the most helpful write up.
Would it be possible to put your full code somewhere please?
I don't know TypeScript and I tried to make the above code work by first following freecodecamp.org/news/learn-typesc...
However, this is what I get when run
tsc index.ts:If a corresponding standard Javascript version could also be provided, that'd be more appreciated.
Thanks!