diff --git a/misc_docs/syntax/language_type.mdx b/misc_docs/syntax/language_type.mdx new file mode 100644 index 000000000..4b58c4102 --- /dev/null +++ b/misc_docs/syntax/language_type.mdx @@ -0,0 +1,49 @@ +--- +id: "type" +keywords: ["type"] +name: "type" +summary: "This is the `type` keyword" +category: "languageconstructs" +--- + +The `type` keyword is used to declare a _type_, including [Records](/docs/manual/latest/record), [Variants](/docs/manual/latest/variant) and [Polymorphic Variants](/docs/manual/latest/polymorphic-variant). + +### Example + + + +```res +type location = { + name: string, + coordinates: (float, float), + keywords: array, +} + +let uluru: location = { + name: "Uluru", + coordinates: (-25.344490, 131.035431), + keywords: ["Rock", "Australia"], +} +``` + +```js +var uluru_coordinates = [-25.34449, 131.035431]; + +var uluru_keywords = ["Rock", "Australia"]; + +var uluru = { + name: "Uluru", + coordinates: uluru_coordinates, + keywords: uluru_keywords, +}; +``` + + + +### References + +* [ReScript Types](/docs/manual/latest/type) +* [Record Types](/docs/manual/latest/record) +* [Variant Types](/docs/manual/latest/variant) +* [Polymorphic Variant Types](/docs/manual/latest/polymorphic-variant) +