In the cost declaration, the syntax is correct, but you need to reverse the arguments:
/*number cost{type, loc}=[21.00 22.50 */
number cost{loc, type}=[21.00 22.50
In the objective declaration, you need to refer to the index sets in the SUM operator:
/*minimize total_cost = sum{i,j in x, i,j in cost} x[i,j]*cost[i,j];*/
minimize total_cost = sum{i in loc, j in type} x[i,j]*cost[i,j];
In the capacity constraint declaration, you need an index for each constraint, and the sum is over j:
/*con capacity: sum{i in loc}x[i,j]<=cap[i];*/
con capacity{i in loc}: sum{j in type}x[i,j]<=cap[i];
In the demand constraint declaration, you need an index for each constraint, the sum is over i, and the <= should be >=:
/*con demand: sum{j in type}x[i,j]<=dem[j];*/
con demand{j in type}: sum{i in loc}x[i,j]>=dem[j];
As a new user, you might find this book of examples helpful.