types APIs
- SimpleOptions
- RootState
- User
- ChainType
- FeedbackCategoryAPI
- FeedbackStatusAPI
- FeedbackUserProfileAPI
- NavItems
- SingleNavItem
- NonNullableChildrenDeep
- SingleArticle
- ColumnType
- DataType
- Hub
- PluginConfig
- RawEventMessage
- DualStakingInfo
- StakingInfo
- SyrupInfo
- CommonStakingInfo
- LairInfo
- StakingBasic
- DualStakingBasic
- SyrupBasic
- Questionnaire
- TaskStatuses
- LoginPayload
- SignupPayload
- MutationType
- ProteinSize
- Config
- Themes
- defaults
- CoordinateSpaceInitial
- Background
- Metric
- Metadata
- TManageValue
- Domain
- Organization
- OrganizationTag
- Scan
- ScanSchema
- Query
- SavedSearch
- Role
- ScanTask
- Vulnerability
- GenericObject
- Annotation
- AnnotationList
- VideoAnnotation
- IconName
- IllustrationName
- INotification
- BottomTabScreens
- KYCScreens
- CCVPScreens
- LoginScreens
- PreAuthScreens
- SignUpScreens
- TFAScreens
- PNVScreens
- ProfileScreens
- SecurityScreens
- SMTYFScreens
- WalletScreens
- WithdrawalScreens
- StackNavigationProps
- Coin
- Country
- TransactionStatus
- SetApiActionPayloadInterface
- LoadingStateInterface
- MessageStateInterface
- UiOptionType
- ApiDiffInterface
- ApiStateInterface
- Account
- NFT
- NFTDetails
- AlertType
- DefaultTemplateOptions
- ProviderProps
- AlertTimer
- AlertInstance
- AlertOptions
- TemplateAlertOptions
- AlertContainerFactory
- ChainBase
- ChainNetwork
- WalletId
- ProposalType
- ChainEventNotification
- WebsocketMessageNames
- WebsocketNamespaces
- NotificationCategories
- InviteCodeAttributes
- IPostNotificationData
- ChainCategoryType
- Screens
- NavigationProperty
- IP
- Maybe
- Tuple
- ChainProperties
- ApiPromise
- ApiAction
- BlueprintOptions
- ContractQuery
- ContractOptions
- ContractTx
- KeyringPair
- ContractDryRunParams
- InstantiateData
- SubmittableExtrinsic
- DbState
- OnInstantiateSuccess$Code
- OnInstantiateSuccess$Hash
- InstantiateState
- ApiState
- OrFalsy
- Bytes
- AbiParam
- Registry
- Weight
- SubmittableResult
- Hash
- CodeBundleDocument
- MyCodeBundles
- ContractDocument
- MyContracts
- Database
- DbStatistics
- UserDocument
- QueuedTxOptions
- TransactionsState
- DropdownOption
- DropdownProps
- ValidFormField
- SetState
- BN
- CallResult
- ContractPromise
- RegistryError
- Abi
- TypeDef
- Validation
- FileState
- UseWeight
- ArgComponentProps
- TypeDefInfo
- UseMetadata
- AbiMessage
- AbiConstructor
- InstantiateProps
- CodeSubmittableResult
- BlueprintSubmittableResult
- BlueprintPromise
- Step2FormData
- TxOptions
- TransactionsQueue
- Keyring
- DbQuery
- UseBalance
- CodeBundle
- ValidateFn
- MetadataState
- UseStepper
- UseToggle
- Party
- Restaurant
- BoardMember
- Id
- Label
- Priority
- Avatar
- PriorityValue
- AuthSetup
- IColumn
- Board
- ITask
- TaskComment
- NewTaskComment
- WithTheme
- UserDetail
- TasksByColumn
- NewTask
- ValueOf
- APIResponse
- Nullable
- Currency
- Route
- Author
- Post
- Category
- Watch
- ComputeCallback
Other Related APIs
types#NonNullableChildrenDeep TypeScript Examples
The following examples show how to use
types#NonNullableChildrenDeep.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: [slug].tsx From next-saas-starter with MIT License | 6 votes |
export async function getStaticPaths() {
const postsListData = await staticRequest({
query: `
query PostsSlugs{
getPostsList{
edges{
node{
sys{
basename
}
}
}
}
}
`,
variables: {},
});
if (!postsListData) {
return {
paths: [],
fallback: false,
};
}
type NullAwarePostsList = { getPostsList: NonNullableChildrenDeep<Query['getPostsList']> };
return {
paths: (postsListData as NullAwarePostsList).getPostsList.edges.map((edge) => ({
params: { slug: normalizePostName(edge.node.sys.basename) },
})),
fallback: false,
};
}
Example #2
Source File: [slug].tsx From next-saas-starter with MIT License | 5 votes |
export default function SingleArticlePage(props: InferGetStaticPropsType<typeof getStaticProps>) {
const contentRef = useRef<HTMLDivElement | null>(null);
const [readTime, setReadTime] = useState('');
useEffect(() => {
calculateReadTime();
lazyLoadPrismTheme();
function calculateReadTime() {
const currentContent = contentRef.current;
if (currentContent) {
setReadTime(getReadTime(currentContent.textContent || ''));
}
}
function lazyLoadPrismTheme() {
const prismThemeLinkEl = document.querySelector('link[data-id="prism-theme"]');
if (!prismThemeLinkEl) {
const headEl = document.querySelector('head');
if (headEl) {
const newEl = document.createElement('link');
newEl.setAttribute('data-id', 'prism-theme');
newEl.setAttribute('rel', 'stylesheet');
newEl.setAttribute('href', '/prism-theme.css');
newEl.setAttribute('media', 'print');
newEl.setAttribute('onload', "this.media='all'; this.onload=null;");
headEl.appendChild(newEl);
}
}
}
}, []);
const { slug, data } = props;
const content = data.getPostsDocument.data.body;
if (!data) {
return null;
}
const { title, description, date, tags, imageUrl } = data.getPostsDocument.data as NonNullableChildrenDeep<Posts>;
const meta = { title, description, date: date, tags, imageUrl, author: '' };
const formattedDate = formatDate(new Date(date));
const absoluteImageUrl = imageUrl.replace(/\/+/, '/');
return (
<>
<Head>
<noscript>
<link rel="stylesheet" href="/prism-theme.css" />
</noscript>
</Head>
<OpenGraphHead slug={slug} {...meta} />
<StructuredDataHead slug={slug} {...meta} />
<MetadataHead {...meta} />
<CustomContainer id="content" ref={contentRef}>
<ShareWidget title={title} slug={slug} />
<Header title={title} formattedDate={formattedDate} imageUrl={absoluteImageUrl} readTime={readTime} />
<MDXRichText content={content} />
</CustomContainer>
</>
);
}