Data in the Tensor is always stored flattened as types 1 dimensional array, for speed.
The example you gave will not work, because 2nd parameter to tensor2d is shape. To make it work you either need to wrap it another array:
const x = tf.tensor2d([[1, 2, 3, 4], [2, 2, 5, 3]]); //shape inferred as [2, 4]
or you could explicitly provide shape:
const x = tf.tensor2d([1, 2, 3, 4, 2, 2, 5, 3], [2, 4]); // shape explicitly passed
as you suggested though, when you inspect data you will always get 1 dimensional array, regardless of original shape
await x.data() // Float32Array(8) [1, 2, 3, 4, 2, 2, 5, 3]
x.shape // [2, 4]
if however you print() your tensor, shape is taken into account and it will appear as
Tensor
[[1, 2, 3, 4],
[2, 2, 5, 3]]