How to properly replace `client.resolved_capabilities` with lspconfig?

I had this in my config config:

require('lspconfig').tsserver.setup {
  on_attach = function(client, bufnr)
    client.resolved_capabilities.document_formatting = false
    client.resolved_capabilities.document_range_formatting = false
    on_attach(client, bufnr)
  end,
}

But the resolved_capabilities is now deprecated. How to mimic this code with the introduced server_capabilities?

This is how:

require('lspconfig').tsserver.setup {
  on_attach = function(client, bufnr)
    client.server_capabilities.documentFormattingProvider = false
    client.server_capabilities.documentRangeFormattingProvider = false
    on_attach(client, bufnr)
  end,
}