« first day (4423 days earlier)      last day (516 days later) » 

7:07 AM
It's not completely dead yet :D
 
7:49 AM
Hi Everyone. I am trying to mock request using axios mock adapter. can you please tell me how can I forward request from inside reply method? i want to send mock response or forward it conditionally for specific route.
https://github.com/ctimmerm/axios-mock-adapter#example
 
8:45 AM
Good morning/afternoon/night, Im working with VUE and Jest to do some unit test but I couldn't make it work. Working with window.addEventListenet when component is mounted and then trying to assert the callback function in that listener. Maybe any of you could help me? here is the link where you can see the code: stackoverflow.com/questions/74565642/…
 
@MariaJulietaLibert Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
 
10 hours later…
 
 
3 hours later…
9:16 PM
hello, can you recommend me some good vuejs architecture projects?
that also focus on the API models vs view related models
i come from java and i find it really hard to find a structure/architecture for vue js
 
 
2 hours later…
10:56 PM
Can I ask typescript questions?
error TS7006: Parameter 'req' implicitly has an 'any' type.
Do I have to give types to every variable?
// the code below errors
app.get('/', (req, res) => {
// if i add a type the error goes away (others still appear)
app.get('/', (req:any, res:any) => {
 
11:16 PM
if parameters implicitly have descriptive types, like string, number, MyType, etc, then it isnt a big issue
when a parameter implicitly has an any type, then it can be an issue, as the any type is kind of problematic and the tools can give very little helpful information to avoid errors at build time or whatever
 
it looks like typescript has a setting that errors if you don't have a type
but if i use any type how is that better?
the code above is from expressjs. and the parameters are a request object and a response object
 
if you explicitly state that they are any types, you tell the tools that you accept that it is an any type
 
ok i see
does typescript have a way of helping me know what class or type it is?
 
you say "I am aware it is an any type and I am aware that I wont receive useful autocompletion, build errors or navigation"
 
req:RequestClass
good point
 
11:20 PM
you can also disallow : any entirely
and then you, as dev, have to use unknown instead
 
so can i set the type to any and then when i run the code check for the type so then i can properly type it?
 
you could
 
console.log(req.constructor.name)
 
nah, just do if (req instanceof RequestClass)
 
well i guessed at the type "RequestClass" i don't know what class it is
 
11:21 PM
although, I would blame whatever provided you the "app.get" function
I assume express
 
yes, i'm using expressjs and i'm still going through it
 
maybe you forgot to add @types/express library (if it even exists)
 
i don't remember adding it
 
many libraries have an @types/library npm package that provides type information about that library for people that use typescript
 
i see
 
11:23 PM
> This package contains type definitions for Express (expressjs.com).
without it, TypeScript is like "I dont know what the heck all of this express stuff is"
so it will default everything to "any"
 
where did you find that
 
npm
the link I linked
 
oh i see
thanks
is there a standard typing syntax?
name:string
name :string
name: string
name : string
 
name: string
I think
and if it isnt, I need to clap someone
 
ok it looks more readable
if i have this function it gives that error:
getFile(file:File)
TS2749: 'File' refers to a value, but is being used as a type here. Did you mean 'typeof File'?
would this be correct?
getFile(file:typeof File)
that seemed to get rid of the error
will JS ever get types or should we use typescript?
 

« first day (4423 days earlier)      last day (516 days later) »