Skip to content

Type 'HTMLElement | null' is not assignable to type 'HTMLElement'. Type 'null' is not assignable to type 'HTMLElement'.ts(2322) #1

@a1tem

Description

@a1tem

Hi, tried this library with the nuxt3 framework, and got an error:

Type 'HTMLElement | null' is not assignable to type 'HTMLElement'.
Type 'null' is not assignable to type 'HTMLElement'.ts(2322)
np-select.d.ts(85, 2): The expected type comes from property 'root' which is declared here on type 'NpCitySelectConfig'

<template>
    <div>
        Nova Poshta Field

        <input type="text" id="city">
    </div>
</template>

<script setup lang="ts">
import { NpCitySelect, NpWarehouseSelect, utils } from 'np-select';

NpCitySelect({
    apiKey: 'b87d9e34dd42ed852b7b1f0bb....1212',
    input: {
      name: 'city',
      placeholder: 'Select City',
    },
    button: {
      text: 'Select City',
    },
    root: document.querySelector('#city'),
  });

</script>

SCR-20231101-jnvj

Any ideas on how to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions