---
layout: docs
title: setType
id: class.Facebook.HackCodegen.CodegenProperty.setType
docid: class.Facebook.HackCodegen.CodegenProperty.setType
permalink: /docs/reference/class.Facebook.HackCodegen.CodegenProperty.setType/
---
# Facebook\\HackCodegen\\CodegenProperty::setType()




Set the type of the member var




``` Hack
public function setType(
  string $type,
): this;
```




In Hack, if it's nullable
you should prepend the question mark, e.g. "?string".




## Parameters




+ ` string $type `




## Returns




* ` this `