# 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
importcreateClientfrom'microlink.io'

constmicrolink=createClient()

constproductHunt=id=>

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

name:{

selector:'h1 a',

attr:'text',

type:'string'

},

upvotes:{

selector:'.bigButtonCount_10448',

attr:'text',

type:'number'

}

})

constproductSlug='microlink-2-0'

const{name,upvotes}=awaitproductHunt(productSlug)

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

The data shape ensures that the extracted value will only be considered as valid when it's of the declared shape: a rule whose value doesn't match its `type` resolves to `null`, which is what lets [fallback rules](https://microlink.io/docs/sdk/methods/extract#fallback-rules) move on to the next candidate.

Media types do more than validate. 'image', 'video', 'audio', and 'logo' resolve the value to an absolute URL and expand it into an asset object with `url`, `type`, `width`, `height`, `size`, and `size_pretty`, the same shape the normalized [data fields](https://microlink.io/docs/api/getting-started/data-fields) use:

```js
const{cover}=awaitmicrolink.extract(

'https://www.youtube.com/watch?v=9P6rdqiybaw',

{

cover:{

selector:'meta[property="og:image"]',

attr:'content',

type:'image'

}

}

)

console.log(cover.width,cover.height,cover.size_pretty)
```