Encapsulation best practices

When making fields public everything works fine, but how should we handle encapsulation?
As an example, say I have a C# class:

public class MyClass
{
    public string name;
}```
Then declare the type:
```export declare type MyClass = {
    name: string
}```
If I want to encapsulate the field like this:
```[System.Serializable]
public class MyClass
{
    [SerializeField] string name;
    public string Name { get => name; }
}```
What would the TypeScript type declaration would look like?

[Original Post on Discord](https://discord.com/channels/717429793926283276/1064486613889073182)

*by user 732122195614105653*

So your goal would be to have a custom type with a getter only / private field?

You could write it like this:

export class MyClass {
  @serializable()  
  private name : string;
  get Name() : string { return this.name; }
}