Post

Nice! It reminds me of the pattern I like to use in my projects: interface AbsDirectoryPath { readonly path: AbsPath; pathAt(relativePath: string): AbsPath; } Commonly-used directories have classes that extend AbsDirectoryPath with more methods. WorkspaceDir, TestDir, etc.

I do this pretty much every time I build a moderately complex codebase that uses a file system. For me it usually ends up as a relative path and an absolute path type.

YES‼️ Node needs this SO BAD! Half the APIs accept a file path, the other half accept a file URL string, and yet another half accept both and a URL instance, and god help you if you guess wrong (spoiler: silent 🤷‍♂️ failure).

No, these types are very specific to our own invariants and wouldn't make sense for other people, and include runtime funcs that convert regular strings to them or validate