Compose and check JS types at runtime