Repository navigation
Conversation
Metro writes df/theme.d.ts (the tokens of devup.json) and df/native.d.ts when it reads the config, as the web plugins do. native.d.ts imports the new @devup-ui/react/native/types, which fills the new DevupElementProps augmentation point so each component takes the props of the React Native component it renders. Web types are unchanged. The Expo example now type-checks in CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #411, depends on #1051 (base:
feat/react-native-web). PR 12 of the React Native plan: the type side of design §8 step 8, "theme type generation for RN projects", and RN-typed props (§6src/types/).What it does
@devup-ui/metro-plugin: when Metro reads the config,withDevupUIwrites two files intodf/(the newdistDiroption), as the web plugins do. The directory ignores itself in git.theme.d.ts: the theme interface of devup.json, from the samegetThemeInterfacethe web plugins use, so$tokensand typography complete.native.d.ts:import '@devup-ui/react/native/types'.@devup-ui/react: a new augmentation point,DevupElementProps. A default-element component reads its element's props throughDevupIntrinsicProps<T>, which isReact.ComponentProps<T>unless the interface namesT. Web types are unchanged: the interface is empty there, and every web type test still passes.@devup-ui/react/native/types(new, types only): it fills that interface, so each component takes the props of the React Native component the build renders it as:divtakesViewProps(Box,Flex,VStack,Center,Grid);spantakesTextProps,imgtakesImageProps,inputtakesTextInputPropsandbuttontakesPressableProps;className, forcss()(D3).onPress,onChangeText,onLayout,testIDand the other React Native props type-check. HTML-only props such ashrefandonInputbecome type errors.@devup-ui/react), this works through module augmentation, not a separate component package.Tests
type-tests/native(source): it checks React Native props on each component,css()withclassName, and style props. It also expectshrefon aViewandonInputon aTextInputto be type errors. Without the augmentation, the same file fails. It runs intest:types, which is part of the build.type-tests/published/tsconfig.native.jsonchecks the builtdistthrough the package exports.rollup.types.config.mjskeepsnative/types.d.tsas a hand-written declaration.theme.d.tswith a token,native.d.tsand.gitignore;distDiroption;tsc --noEmitpreviously failed ononPress/onChangeText, and now passes;expoCI job runs it astypecheckafter the export;packages/react/src/types/.feat/react-native-webis added to thepull_requestbranches of the workflow.#411의 일부이며 #1051에 의존합니다 (base:
feat/react-native-web). React Native 계획의 12번째 PR로, 설계 §8 8단계 중 "RN 프로젝트용 theme 타입 생성"과 RN 기준 props 타입(§6src/types/)입니다.변경 내용
@devup-ui/metro-plugin: Metro가 config를 읽을 때withDevupUI가 웹 플러그인처럼df/(새distDir옵션)에 두 파일을 씁니다. 디렉터리는 스스로 git에서 제외됩니다.theme.d.ts: 웹 플러그인과 같은getThemeInterface로 만든 devup.json의 테마 interface입니다. 그래서$토큰과 typography가 자동완성됩니다.native.d.ts:import '@devup-ui/react/native/types'.@devup-ui/react: 새 augmentation 지점DevupElementProps를 추가했습니다. 기본 요소 컴포넌트는DevupIntrinsicProps<T>로 요소의 props를 읽습니다. 이 타입은 interface에T가 없으면React.ComponentProps<T>입니다. 웹에서는 interface가 비어 있으므로 웹 타입은 그대로이고, 웹 타입 테스트도 모두 통과합니다.@devup-ui/react/native/types(신규, 타입 전용): 위 interface를 채워, 각 컴포넌트가 빌드가 렌더링하는 React Native 컴포넌트의 props를 받게 합니다:div는ViewProps(Box·Flex·VStack·Center·Grid);span은TextProps,img는ImageProps,input은TextInputProps,button은PressableProps;css()용className(D3)도 받습니다.onPress·onChangeText·onLayout·testID등 React Native props가 타입 검사를 통과합니다.href·onInput같은 HTML 전용 props는 타입 에러가 됩니다.@devup-ui/react에서 계속 import)를 따르므로, 별도 컴포넌트 패키지가 아니라 module augmentation으로 동작합니다.테스트
type-tests/native(소스): 각 컴포넌트의 React Native props,className과css(), 스타일 props를 검사합니다.View의href와TextInput의onInput은 타입 에러여야 합니다. augmentation이 없으면 같은 파일이 실패합니다. 빌드에 포함된test:types에서 실행됩니다.type-tests/published/tsconfig.native.json은 빌드된dist를 package exports를 통해 검사합니다.rollup.types.config.mjs는native/types.d.ts를 직접 작성한 선언 파일로 유지합니다.theme.d.ts,native.d.ts,.gitignore작성;distDir옵션;onPress/onChangeText에서 실패하던tsc --noEmit이 이제 통과합니다;expoCI job이 export 뒤에 이를typecheck로 실행합니다;packages/react/src/types/도 포함합니다.pull_requestbranches에feat/react-native-web을 추가했습니다.🤖 Generated with Claude Code