You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: move internal modifier out of experimental (microsoft#10855)
The `internal` access modifier has been stable with no issues, so it no
longer needs the experimental warning. This removes the
`experimental-feature` diagnostic emitted on every use of `internal` and
cleans up all associated suppressions.
## Changes
- **`modifiers.ts`** — Remove the block that emitted
`experimental-feature` (`messageId: "internal"`) whenever the `internal`
modifier was used
- **`messages.ts`** — Remove the `internal` messageId from the
`experimental-feature` diagnostic definition
- **`prototypes.tsp`** — Remove `#suppress "experimental-feature"` from
`internal extern dec` (decorator declarations were never independently
experimental; the suppress was only needed for `internal`)
- **`visibility.tsp`, `private.decorators.tsp`** — Retain existing
`#suppress "experimental-feature"` on `internal extern fn` declarations
— function declarations (`fn`) remain experimental
- **`internal.test.ts`** — Update tests to reflect `internal` no longer
emits any diagnostic; previously-allowed usages that only expected
`experimental-feature` now expect clean compilation
- **`access-modifiers.md`** — Remove the "Suppressing the experimental
warning" section
### Before / After
```typespec
// Before: emits experimental-feature warning, requires suppression
#suppress "experimental-feature" "suppress internal warning"
internal model MyInternalModel {}
// After: no warning, no suppression needed
internal model MyInternalModel {}
```
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
The `internal` modifier is no longer experimental. Using `internal` will no longer emit an `experimental-feature` warning, and `#suppress "experimental-feature"` directives are no longer needed.
Copy file name to clipboardExpand all lines: packages/compiler/src/core/messages.ts
-1Lines changed: 0 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -267,7 +267,6 @@ const diagnostics = {
267
267
default: paramMessage`${"feature"} is an experimental feature. It may change in the future or be removed. Use with caution and consider providing feedback on this feature.`,
268
268
functionDeclarations:
269
269
"Function declarations are an experimental feature that may change in the future. Use with caution and consider providing feedback to the TypeSpec team.",
270
-
internal: `Internal symbols are experimental and may be changed in a future release. Use with caution. Suppress this message ('#suppress "experimental-feature"') to silence this warning.`,
it(`allows 'internal' on ${keyword} declaration (with experimental warning)`,async()=>{
18
+
it(`allows 'internal' on ${keyword} declaration`,async()=>{
19
19
constdiagnostics=awaitTester.diagnose(code);
20
-
expectDiagnostics(diagnostics,{
21
-
code: "experimental-feature",
22
-
severity: "warning",
23
-
message: `Internal symbols are experimental and may be changed in a future release. Use with caution. Suppress this message ('#suppress "experimental-feature"') to silence this warning.`,
Copy file name to clipboardExpand all lines: website/src/content/docs/docs/language-basics/access-modifiers.md
-9Lines changed: 0 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,15 +92,6 @@ The `internal` modifier can be combined with the `extern` modifier on decorator
92
92
internal extern dec myInternalDecorator(target: unknown);
93
93
```
94
94
95
-
### Suppressing the experimental warning
96
-
97
-
Since access modifiers are currently experimental, using `internal` will emit a warning. You can suppress this warning with a `#suppress` directive:
98
-
99
-
```typespec
100
-
#suppress "experimental-feature"
101
-
internal model MyInternalModel {}
102
-
```
103
-
104
95
## Why not `namespace`?
105
96
106
97
The `internal` modifier is not supported on namespaces because namespaces in TypeSpec are **open and merged** across files. A namespace declared in one file can be extended in another file — potentially across library boundaries. Applying `internal` to a namespace would create ambiguity about which parts of the namespace are internal and which are public. Instead, mark individual declarations within a namespace as `internal`.
0 commit comments