Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 09a8845

Browse files
committed
Emit an error when a @string or @int attribute is used in V4.
Fixes rescript-lang/rescript#5724
1 parent a40b8b6 commit 09a8845

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

cli/reactjs_jsx_v4.ml

+14
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,19 @@ let argToConcreteType types (name, _loc, type_) =
708708
| name when isOptional name -> (true, getLabel name, [], type_) :: types
709709
| _ -> types
710710

711+
let check_string_int_attribute_iter =
712+
let attribute _ ({txt; loc}, _) =
713+
if txt = "string" || txt = "int" then
714+
React_jsx_common.raiseError ~loc
715+
"@string and @int attributes not supported. See \
716+
https://github.com/rescript-lang/rescript-compiler/issues/5724"
717+
in
718+
719+
{Ast_iterator.default_iterator with attribute}
720+
711721
let transformStructureItem ~config mapper item =
722+
check_string_int_attribute_iter.structure_item check_string_int_attribute_iter
723+
item;
712724
match item with
713725
(* external *)
714726
| {
@@ -1158,6 +1170,8 @@ let transformStructureItem ~config mapper item =
11581170
| _ -> [item]
11591171

11601172
let transformSignatureItem ~config _mapper item =
1173+
check_string_int_attribute_iter.signature_item check_string_int_attribute_iter
1174+
item;
11611175
match item with
11621176
| {
11631177
psig_loc;

0 commit comments

Comments
 (0)