Get ID which has two rows with specific values for one column I have this Table

and would like to select only those IDs that I have as type A B only
The output table should be this table:

Might you be able to share an idea on how to approach this?
WITH cte AS ( SELECT id, type, COUNT(DISTINCT type) OVER (PARTITION BY id) cnt
              FROM table
              WHERE type IN ('A', 'B')
            )
SELECT id, type
FROM cte
WHERE cnt = 2