## Table of Contents

- [type](#type)

---

[](https://microlink.io/docs/api/getting-started/overview)

[API](https://microlink.io/docs/api/getting-started/overview)

[](https://microlink.io/docs/guides)

GUIDES

[](https://microlink.io/docs/mql/getting-started/overview)

MQL

[](https://microlink.io/docs/sdk/getting-started/overview)

SDK

[](https://microlink.io/docs/cards/getting-started/overview)

CARDS

## type

Type:

\<string\> \| \<string\[\]\>

\
Default: 'auto'\
Values:

'audio' \| 'author' \| 'auto' \| 'boolean' \| 'date' \| 'description' \| 'email' \| 'image' \| 'ip' \| 'lang' \| 'logo' \| 'number' \| 'object' \| 'publisher' \| 'regexp' \| 'string' \| 'title' \| 'url' \| 'video'

It defines how the value extracted should be considered.

``` js
const mql = require('@microlink/mql')

const productHunt = id =>

  mql(`https://www.producthunt.com/posts/${id}`, {

    data: {

      name: {

        selector: 'h1 a',

        attr: 'text',

        type: 'string'

      },

      upvotes: {

        selector: '.bigButtonCount_10448',

        attr: 'text',

        type: 'string'

      }

    }

  })

const productSlug = 'microlink-2-0'

const { data } = await productHunt(productSlug)

console.log(`'${data.name}' has ${data.upvotes} upvotes`)
```

The data shape ensures that the extracted value will only be considered as valid when it's of the declared shape.