Posts by Hozeis • 251 points
12 posts
-
1
votes3
answers126
viewsA: Why does type "any" exist in Typescript?
Simply: let var1: any = "Hello World"; var1 can be reset as any other object and typescript will not fight with you pq set it when using any. let var2 = "Hello World"; On that line Oce already…
-
0
votes1
answer21
viewsA: Is it possible for a component to have a map that changes the return according to the prop that was passed?
I don’t know if I understand your question very well. But it would be like this? <tbody> {props.item.map((film) => ( <tr> { Object.keys(film).map((chaveDeObj) =>…
-
-1
votes1
answer52
viewsA: How to use interpolation in declaring a property of a type?
Tries type Props = { [K: `props${number}`]: boolean; }; Also, this type of types Template Literal Types only work with the version of typescript 4.4 and above. UPDATING This answer does not catch…
typescriptanswered Hozeis 251 -
1
votes1
answer21
viewsA: Do not insert null data sequence in Loop POST Reactjs
I believe that delete accepts only one value at a time: delete quantidadeUsada[i]; delete numeroLote[i]; delete id_ProdNfe[I]; delete consumidor_id[i]; The rest would work. More like @Rafael Tavares…
-
1
votes1
answer54
viewsA: How to run a function only after a Javascript API call?
Could use async/await so that the rest of the function checkRouteAuth() awaits the conclusion of isAuthenticated(). async function checkRouteAuth() { await isAuthenticated(); let aux =…
-
0
votes1
answer37
viewsA: python old game sometimes shows no result
Every time Voce checks whether your option matches random.choice([pedra, papel, tesoura]).capitalize(): Voce is creating a new value for the system option. Create a variable before your ifs and uses…
-
-1
votes1
answer45
views -
0
votes1
answer20
viewsA: How to return a list of specific fields in an Aggregation in Mongodb
I believe it would be so: const fieldsObj: { [key: string]: number} = {}; fields.forEach((field)=> fieldsObj[field] = 1) const agg = [ ... items: [ // pula x itens no offset pra paginação{ $skip:…
-
0
votes2
answers56
viewsA: How to pass a specific object as props in a generation of components?
I believe you’re using function map incorrectly. The first parameter already returns the value of the item within the array. {box.map((itemDeBox, index)=>{ return <Box key={index}…
-
0
votes2
answers190
viewsA: Create object and send by ajax - Codeigniter
If Voce wants to remove the Mask before sending the results via ajax, the github.com/igorescobar/jQuery-Mask-Plugin library has available the function unmask(). Then its function remove_mascara();…
-
3
votes2
answers334
viewsA: Sentence separated by comma in an IF Javascript would have what purpose? " if (1, 2) {}"
It was easier for me to understand like this: var test = 5; if(test+=5,test-=6,test==10){ console.log(test); }else{ console.log(test); } Anything before the last expression is executed, but the if…
-
1
votes1
answer28
viewsA: code block only works with F5
Are you talking about $("#select_n") and changing your id to select_' + count. Then inside the click tries to refer to new id. $("#select_"+(count-1)). var count = 0; $( document ).ready(function()…