Closed shirakaba closed 3 years ago
Note: The typings give compiler errors:
// This is the auto-generated type:
type CoreTypes = import("@nativescript/core").CoreTypes;
// ...
// This is the compiler error:
androidContentInset?: string | number | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit;
// ^ Cannot find namespace 'CoreTypes'. ts(2503)
// Exported type alias 'ActionBarAttributes' has or is using private name 'CoreTypes'. ts(4081)
This is because @nativescript/core/core-types/index.d.ts
uses export namespace
, so it's a namespace rather than an interface that's being imported, for once:
We can solve this using:
// Approach 1 – type import:
// I think that the use an import might change the declaration from script context to module context,
// so might be a no-go for Svelte Native; I'm not really sure whether type imports work that way.
import type { CoreTypes } from "@nativescript/core";
// Approach 2 – reconstruct the namespace as a type, property-by-property:
type CoreTypes = {
LengthDipUnit: import("@nativescript/core").CoreTypes.LengthDipUnit,
};
I'm working around this manually at present.
The remaining errors, can be fixed by these manual changes:
- type CSSShadow = import("@nativescript/core").CSSShadow;
+ type CSSShadow = import("@nativescript/core/ui/styling/css-shadow").CSSShadow;
- type NavigationData = import("@nativescript/core").NavigationData;
+ type NavigationData = import("@nativescript/core/ui/frame").NavigationData;
- type SelectedIndexChangedEventData = import("@nativescript/core").SelectedIndexChangedEventData;
+ type SelectedIndexChangedEventData = import("@nativescript/core/ui/segmented-bar").SelectedIndexChangedEventData;
- type TabViewSelectedIndexChangedEventData = import("@nativescript/core").SelectedIndexChangedEventData;
+ type TabViewSelectedIndexChangedEventData = import("@nativescript/core/ui/tab-view").SelectedIndexChangedEventData;
Awesome, I had a branch I had not pushed that have some of these changes, but they are still manual fixes. I'll have a crack at detecting and automating the namespace fields
Looks like the Pro UI components didn't really change.
As expected, the Tabs and BottomNavigation components (and subcomponents), are removed.