# Define typedef field named 'class'

**URL:** <https://community.haxe.org/t/define-typedef-field-named-class/1351>\
**Category:** Haxe\
**Created:** [December 7, 2018, 9:58am UTC](https://community.haxe.org/t/define-typedef-field-named-class/1351 "2018-12-07T09:58:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![remcohuijser](https://community.haxe.org/user_avatar/community.haxe.org/remcohuijser/32/356_2.png) [@remcohuijser](https://community.haxe.org/u/remcohuijser)\
**Post date:** [December 7, 2018, 9:58am UTC](https://community.haxe.org/t/define-typedef-field-named-class/1351/1 "2018-12-07T09:58:09Z")

</div>

I want to use this for defining html element types (part of a virtual dom solution) but as class is a reserved word I am not able to do this:

```haxe
typedef Attributes =
{
    id: String,
    style: String,
    class: String
}

```

The name is perfectly valid in JavaScript (as far as I am aware of): so is there a way to trick the compiler into accepting this?

---

<div class="post-metadata">

**Author:** ![kLabz](https://community.haxe.org/user_avatar/community.haxe.org/klabz/32/225_2.png) [@kLabz](https://community.haxe.org/u/kLabz)\
**Post date:** [December 7, 2018, 10:05am UTC](https://community.haxe.org/t/define-typedef-field-named-class/1351/2 "2018-12-07T10:05:41Z")

</div>

Not really =/ (well there’s always some tricks with abstracts or @:structInit interfaces, but they’re far from perfect)

See [@:native metadata on typedef fields · Issue #5105 · HaxeFoundation/haxe · GitHub](https://github.com/HaxeFoundation/haxe/issues/5105) and [Permit json syntax more generally for anon-types. by deltaluca · Pull Request #2185 · HaxeFoundation/haxe · GitHub](https://github.com/HaxeFoundation/haxe/pull/2185)

---

<div class="post-metadata">

**Author:** ![remcohuijser](https://community.haxe.org/user_avatar/community.haxe.org/remcohuijser/32/356_2.png) [@remcohuijser](https://community.haxe.org/u/remcohuijser)\
**Post date:** [December 7, 2018, 2:07pm UTC](https://community.haxe.org/t/define-typedef-field-named-class/1351/3 "2018-12-07T14:07:59Z")

</div>

Thanks for the quick reply: I think we will work around the problem for now 🙂
