microsoft / microsoft/typespec

Global namespace vs file

Open
#9,558 0 comments 0 reactions 0 assignees View on GitHub
compiler:core design:needed triaged:core
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

Wondering if we could make a change so that you never update the global namespace for anything but adding a namespace.

Which means if you add scopeless types to a typespec file it would still scope it to a virtual file namespace and 2 files wouldn't conflict with each other.

For example the following would have no issue

```tsp
import "./b.tsp";

model A {}
```

```tsp
// b.tsp

model A {}
```

This comes up as defining `Model` or `Operation` or any types under `Reflection` directly at the root of a project just crash everything.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.