What does “Convert overload list to single signature” mean?

I am still learning some basics of javascript programming (and programming in general).

In my Angular Firebase project, I get the following typescript error (or rather proposed change in visual studio code, i.e. the lightbulb icon):

Convert overload list to single signature

It is referring to the following code:

  updateUser(user: UserDocument): Observable<any> {
    const ref = doc(this.firestore, 'users', user.uid);
    return from(updateDoc(ref, { ...user }));
  }

When I convert it, it appears like this:

  updateUser(...args: [user: UserDocument]): Observable<any> {
    const ref = doc(this.firestore, 'users', user.uid);
    return from(updateDoc(ref, { ...user }));
  }

But now instead it is complaining Remove unused declaration of args and also it complains about the last bid { ...user } giving another lightbulb Import user from module "rxfire/auth"

I would appreciate it very much if someone gave a short explanation of what is going on?

Thank you!

EDIT: here are two screenshots just for extra clarity

enter image description here

enter image description here

Matter.js light bulb pull

I want it to react when I pull the light bulb

What’s the problem?

I want an alarm to come when I pull the light bulb

but got a error

Uncaught TypeError: Cannot read properties of undefined (reading ‘position’)

    group = Body.nextGroup(true);

  var ropeB = Composites.stack(width/2, 100, 10, 1, 10, 10, function(x, y) {
    return Bodies.rectangle(x , y, 20, 4, {
      collisionFilter: { 
       group: group 
      }, 
      render : ropeRenderStyle
    });
  });

  const lamp =  Matter.Bodies.circle(width/2, 210, 30, {
      density: 0.0005,
                frictionAir: 0.06,
                restitution: 0.3,
                friction: 0.01,
                render: {
                    sprite: {
                        texture: './img/lamp.png',
                        xScale: 0.12,
                        yScale: 0.14
                    }
                }
    })

  Composite.add(ropeB, lamp);

  Composites.chain(ropeB, 0.5, 0, -0.5, 0, {
      stiffness: 0.8,
      length: 1,
      render: ropeRenderStyle
    });

  Composite.add(
      ropeB,
      Constraint.create({
        bodyB: ropeB.bodies[0],
        pointB: { x: 0, y: 0 },
        pointA: { x: ropeB.bodies[0].position.x, y: ropeB.bodies[0].position.y },
        stiffness: 0.5,
        render : ropeRenderStyle
      })
    );

    Events.on(engine, 'collisionStart', () => {
      const { bodies } = engine.world;
      const lamp = bodies.find(body => body.label === 'Circle Body');
      if (lamp.position.y < height) {
        alert("click");
      }   
    });

Javascript: object cannot be updated

I have an object named “order”, and I am trying to change some values within in. Below is the code that I use, but it is showing me some weird behaviour.

All console.log output are included as comments after the corresponding line. As far as I can tell, the code is working because when I try to console.log the new value, it is correctly printed on the console.

The problem happens at my last line of code. When I am printing the entire object on console, and navigate to the two values that I just changed, they are both showing the old value “0.60”, instead of the new value “1.00”.

What is causing this bug?

console.log("this.calculate_discount(product)", this.calculate_discount(product)); // 0.40
console.log("order.SubTotalDiscount", this.order.SubTotalDiscount); // 0.60
this.order.SubTotalDiscount = parseFloat(this.calculate_discount(product)) +
                              parseFloat(this.order.SubTotalDiscount);
this.order.SubTotalDiscount = parseFloat(this.order.SubTotalDiscount).toFixed(2);
console.log("order.SubTotalDiscount", this.order.SubTotalDiscount); // 1.00
console.log("order.totals[TOTAL_CODE_MAP.get('discount_b')].Amount",
                this.order.totals[TOTAL_CODE_MAP.get('discount_b')].Amount); // 0.60
this.order.totals[TOTAL_CODE_MAP.get('discount_b')].Amount = 
                parseFloat(this.calculate_discount(product)) +
                parseFloat(this.order.totals[TOTAL_CODE_MAP.get('discount_b')].Amount);
this.order.totals[TOTAL_CODE_MAP.get('discount_b')].Amount =
                parseFloat(this.order.totals[TOTAL_CODE_MAP.get('discount_b')].Amount).toFixed(2);
console.log("order.totals[TOTAL_CODE_MAP.get('discount_b')].Amount",
                this.order.totals[TOTAL_CODE_MAP.get('discount_b')].Amount); // 1.00
console.log("order", this.order);

Thank you!

Can play button be added to this code structure? (Shopify)

My following codes provide to show html video between the product images. In the mobile view, the play button is located in the middle of the video. Do you think it is possible to do the same in desktop view?

<div class="owl-carousel">
{% for image in product.images %}
{% if forloop.first == true %}
<figure>            
<img src="{{ image.src | img_url: '1024x1024' }}" alt="{{ image.alt | escape }}" class="product_variant_image">
</figure>
{% else %}
<figure>            
<img src="{{ image.src | img_url: '1024x1024' }}" alt="{{ image.alt | escape }}">
</figure>
{% endif %}
{% endfor %}
{% for media in product.media %}
{% if media.media_type == 'video' %}
{{ media | video_tag: controls: true, preload: true, image_size: "768x" }}
{% endif %}
{% endfor %}
</div>

What I want to see is ;

enter image description here

How to make angular find imports automatically in vs code

I have a angular project generated with nrwl/nx, I generated an model folder manually, but if I try to import something from it I have to do it manually. Is there anyway to make a file where I can put the path to my models and it will automatically be found?

I looked a bit and found this in my tsconfig.base.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "rootDir": ".",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "module": "esnext",
    "lib": ["es2017", "dom"],
    "skipLibCheck": true,
    "skipDefaultLibCheck": true,
    "baseUrl": ".",
    "paths": {
      "@moniesta-admin/auth-lib": ["libs/auth-lib/src/index.ts"],
    }
  },
  "exclude": ["node_modules", "tmp"]
}

I tried to add it like my auth-lib folder but that does not work either. This is how the index.ts of auth-lib looks:

export * from './lib/auth-lib.module';

Everything I add to section-2 (text-content spans and header) of my index.html doesn’t show up on page

When I hover over .section-2 in inspector it appears like it’s off the screen but the page won’t let me scroll down. When I turn off position absolute on the header I can see the first two letters of it but again it goes off-screen and doesn’t allow me to scroll.

CSS: 
/* Common Styles */
        * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        text-decoration: none;
        list-style-type: none;
        outline: none;
        font-family: "Jura", sans-serif;
        }

        html {
        font-size: 62.5%;
        scroll-behavior: smooth;
        }

        .section-2{
           position: relative;
           padding: 10rem 10rem 15rem 10rem;
  

        
HTML:
        <section class="section-2" id="section-2">
        <h1 class="section-heading">About Me</h1>
        <p class="about-me-text"></p>
[![Picture of issue][1]][1]


  [1]: https://i.stack.imgur.com/8Fjuf.jpg

GSAP’s Scroll Trigger Function Not Working in React App

feel free to test the behavior here: https://better-web-metrics.herokuapp.com/

I am just starting to use the GSAP 3 API. I am simply trying to have 3 cards animate from 0 to 1, when the user begins to scroll and the cards begin to enter or are completely in the viewport. But what’s happening is though the cards are out of the viewport frame, the animation begins automatically. It’s like the scrollTrigger object has been completely ignored.

What adjustments do I need to make here?
I’d appreciate it.
Ironman

main.js

import { gsap } from "gsap";
import {ScrollTrigger} from "gsap/ScrollTrigger";
gsap.registerPlugin(ScrollTrigger);

function init(){

    gsap.from("article", {
        scrollTrigger:{
            trigger:".cards",
        },
        stagger: {amount: 0.5},
        scale:0, duration:3
    })   
}

window.addEventListener('load', function(){
    init();
});

the html

<section class="cards">

              <article>
                <h1 class="cardHeading">Card 1</h1>
                <p id="aboutTxt01" className="aboutText" >
                "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium
                </p>
              </article>

              <article>
                <h1 class="cardHeading">Card 2</h1>
                <p id="aboutTxt02" className="aboutText" >
                "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium
                </p>
              </article>

              <article>
                <h1 class="cardHeading">Card 3</h1>
                <p id="aboutTxt03" className="aboutText" >
                "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
                </p>
              </article>
            </section>    
        </div>

the relevant css

 header {
    height: 99vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: calc(10px + 2vmin);
    color: white;
    position: relative;
    border: 2px solid green;
  }

  section {
    border: 2px solid red;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
  }

  article {
    width: 300px;
    height: 300px;
    border: 2px solid #4f5165;
    color: #293132;
    padding: 1rem;
    margin-top: -10%;
    margin-right: 1%;
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    align-items: center;
  }

If statement in Cypress

How can i write correctly this code, in such a way that it is a valid if syntax, and if it is not respected, should I have someone else with it?

Basically I want to search for a text in a popup window. If it does not exist, enter the code in else statement.

cy.get(".ibxudA").find('.WildnessText-kRKTej').should('have.text',"Wildness")

Warning:findDOMNode was passed an instance of InputElement which is inside StrictMode.Instead,add a ref directly to the element you want to reference

Estou recebendo este warning, por utilizar o TextField como filho do InputMask conforme código abaixo. Como posso ajustá-lo para resolver este warning ?

<Box>
         <InputMask 
            mask='(99)999999999'
            maskChar=''
            value={user.phone} 
            onChange={event=> handleChange(event,true)}
            onBlur={event=> handleBlur(event)}>
            {inputProps =>
                <TextField
                {...inputProps}
                id='phone' 
                name='phone'
                label='(DDD) + Celular'
                autoComplete='off'
                inputProps={{style:{textAlign:'left'}}}
                InputProps={{
                    classes: {
                        input: styledUpdateUser.resize
                    },
                }}
                sx={styledUpdateUser.mediumTextField}
                helperText={inputvalidation.keys.phone !== '' ? inputvalidation.keys.phone  : ''}
                error={inputvalidation.keys.phone !== '' ? true : false}
                />}
        </InputMask>
    </Box>

Jest variable outside function is undefined while testing function

below is a function i want to test

import { logger } from 'logger';
const log = logger(__filename);

export const foo = () => {
 log('test log');
};

below is my test case

import { foo } from '../../src/utils/foo';
import * as utils from 'logger';
jest.mock('logger');
// eslint-disable-next-line no-undef
const mockedFoo = jest.mocked(utils, true);

describe('Common Utils', function () {
  describe('#foo', function () {
   it('foo', () => {
      // eslint-disable-next-line no-undef
      mockedFoo.logger.mockReturnValueOnce(() => { return { log: jest.fn() }; });
      await foo();
      expect(mockedFoo.logger).toHaveBeenCalledWith('test');
    });
  });
});

when i try to run it gives error log is not defined, it cannot get out of scope variable

How to make a new Array of Object using data from backend which is array of objects?

Hi I am new to Angular and I want to bind my dropdown options with value as

[ { label: "name", value: "id"} ]

as in label should have the below names and the values as the below IDs ( in the image )

I have my backend data as

enter image description here

I want the id and name as my options value for the dropdown.
Please if anyone could guide me

p.s I tried using map function but all I am getting in the options is [object object]

How do I link a csv file to flask?

I have a CSV file of readings from a sensor that I would like to graph with chart.js on a flask server, however I am getting 404 errors when trying to access the CSV file, since I am getting 404 errors I am assuming that I need to actually path the CSV file in flask, but I cant figure out how to do this, I’m coming across a lot of irrelevant information about using flask to make and fill a database but I need to pass the database to an html page to parse for graphing.

Could someone please help me learn how to do this?

Code that I’m testing and playing around with for reading CSV files in JavaScript. Has the route specified in flask code below!

<script>
    //path is from html file location to db location is this right?
    d3.csv("../db/test.csv", function(data) {
        for (var i = 0; i < data.length; i++) {
            console.log(data[i].Test1);
            console.log(data[i].Test2);
            console.log(data[i].Test3);
        }
    });
</script>

Test CSV file.

Test1, Test2, Test3
1, 2, 3

404 Error Details

Any help to better understand how to do this is much appreciated!

forgot my flask code!

@app.route('/test')
def test():
    #every thing that links the csv to flask would go here? Or would I need a more specific function for the csv file?
    return render_template('test.html'), 201

How to connect local storage to button?

I am a beginner and learning by working on tutorials.
I am using the NASA API and displaying the images using a modal. The modals have a button, however, I don’t know how to connect it to the local storage and save it to the favourites section.
Appreciate any help, thanks.

https://jsfiddle.net/neg4byd5

  <!-- The Modal -->
  <div id="myModal" class="modal">
    <span class="close">&times;</span>
    <img class="modal-content" id="img01">
    <span><button>Add To Favourites</button></span>
    <div id="caption"></div>
  </div>


    // Save Text
    const saveText = document.createElement("p");
    saveText.classList.add("clickable");
    if (page === "results") {
      saveText.textContent = "Add To Favorites";
      saveText.setAttribute("onclick", `saveFavorite('${result.url}')`);
    } else {
      saveText.textContent = "Remove Favorite";
      saveText.setAttribute("onclick", `removeFavorite('${result.url}')`);
    }


// Update the DOM
function updateDOM(page) {
  // Get favorites from local storage
  if (localStorage.getItem("nasaFavorites")) {
    favorites = JSON.parse(localStorage.getItem("nasaFavorites"));
  }
  imagesContainer.textContent = "";
  createDOMNodes(page);
  showContent(page);
}


// Add result to favorites
function saveFavorite(itemUrl) {
  // Loop through the results array to select favorite
  resultsArray.forEach((item) => {
    if (item.url.includes(itemUrl) && !favorites[itemUrl]) {
      favorites[itemUrl] = item;
      // Show save confirmation for 2 seconds
      saveConfirmed.hidden = false;
      setTimeout(() => {
        saveConfirmed.hidden = true;
      }, 2000);
      // Set Favorites in Local Storage
      localStorage.setItem("nasaFavorites", JSON.stringify(favorites));
    }
  });
}

// Remove item from favorites
function removeFavorite(itemUrl) {
  if (favorites[itemUrl]) {
    delete favorites[itemUrl];
    localStorage.setItem("nasaFavorites", JSON.stringify(favorites));
    updateDOM("favorites");
  }
}

// On Load
getNasaPictures();