Repository: alloy-framework/alloy
Pull request #226 (2025-06-27 15:20:23)

Property required modifier

pkg-pr-new[bot]: 
[Open in StackBlitz](https://pkg.pr.new/template/b8cf680d-af20-47be-ace7-ba1aaf7c0967)


<details><summary><b>@alloy-js/babel-plugin</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/babel-plugin@226
```

</p></details>
      
    

<details><summary><b>@alloy-js/babel-plugin-jsx-dom-expressions</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/babel-plugin-jsx-dom-expressions@226
```

</p></details>
      
    

<details><summary><b>@alloy-js/babel-preset</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/babel-preset@226
```

</p></details>
      
    

<details><summary><b>@alloy-js/cli</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/cli@226
```

</p></details>
      
    

<details><summary><b>@alloy-js/core</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/core@226
```

</p></details>
      
    

<details><summary><b>@alloy-js/create</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/create@226
```

</p></details>
      
    

<details><summary><b>@alloy-js/csharp</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/csharp@226
```

</p></details>
      
    

<details><summary><b>@alloy-js/java</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/java@226
```

</p></details>
      
    

<details><summary><b>@alloy-js/json</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/json@226
```

</p></details>
      
    

<details><summary><b>@alloy-js/markdown</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/markdown@226
```

</p></details>
      
    

<details><summary><b>@alloy-js/prettier-plugin-alloy</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/prettier-plugin-alloy@226
```

</p></details>
      
    

<details><summary><b>@alloy-js/rollup-plugin</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/rollup-plugin@226
```

</p></details>
      
    

<details><summary><b>@alloy-js/typescript</b></summary><p>

```
npm i https://pkg.pr.new/alloy-framework/alloy/@alloy-js/typescript@226
```

</p></details>
      
    

_commit: <a href="https://github.com/alloy-framework/alloy/runs/44936100796"><code>ec56ef2</code></a>_


Patch:
diff --git a/.chronus/changes/property-required-mod-2025-5-27-8-20-10.md b/.chronus/changes/property-required-mod-2025-5-27-8-20-10.md
new file mode 100644
index 0000000..4886d2d
--- /dev/null
+++ b/.chronus/changes/property-required-mod-2025-5-27-8-20-10.md
@@ -0,0 +1,6 @@
+---
+changeKind: internal
+packages:
+  - "@alloy-js/csharp"
+---
+
diff --git a/packages/csharp/src/components/property/property.tsx b/packages/csharp/src/components/property/property.tsx
index 707bee1..6ff04f3 100644
--- a/packages/csharp/src/components/property/property.tsx
+++ b/packages/csharp/src/components/property/property.tsx
@@ -29,6 +29,11 @@ export interface PropertyModifiers {
   readonly abstract?: boolean;
   readonly extern?: boolean;
   readonly readonly?: boolean;
+  /**
+   * Set required modifier on property
+   * https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/required
+   */
+  readonly required?: boolean;
 }
 
 const getModifiers = makeModifiers<PropertyModifiers>([
@@ -40,6 +45,7 @@ const getModifiers = makeModifiers<PropertyModifiers>([
   "abstract",
   "extern",
   "readonly",
+  "required",
 ]);
 
 /** Properties for {@link Property} component */


Test patch:
diff --git a/packages/csharp/src/components/property/property.test.tsx b/packages/csharp/src/components/property/property.test.tsx
index 5696a57..63eb77f 100644
--- a/packages/csharp/src/components/property/property.test.tsx
+++ b/packages/csharp/src/components/property/property.test.tsx
@@ -46,6 +46,7 @@ describe("modifiers", () => {
       "abstract",
       "extern",
       "readonly",
+      "required",
     ] as const)("%s", (methodModifier) => {
       expect(
         <Wrapper>