Skip to content

fix(core): type collisions with namespace#8809

Merged
NathanWalker merged 14 commits intofix/feature-cleanupfrom
fix/type-collisions-namespace
Feb 26, 2021
Merged

fix(core): type collisions with namespace#8809
NathanWalker merged 14 commits intofix/feature-cleanupfrom
fix/type-collisions-namespace

Conversation

@NathanWalker
Copy link
Contributor

@NathanWalker NathanWalker commented Sep 2, 2020

What is the current behavior?

Currently while using import { Enums } from '@nativescript/core'; in es2017 there was no clear way to delineate between type definition and namespace/module as they were overloaded throughout.

import { Enums } from '@nativescript/core';

const left = Enums.TextAlignment.left; // works
const leftAssignment: Enums.TextAlignment = 'left'; // doesn't work

There was a workaround that you could do:

const left: typeof Enums.TextAlignment;

...but that's pretty inconvenient.

Also the barrel was missing a few ui property getter/setters for plugin usage.

What is the new behavior?

Type has been added to suffix any exported type named symbols for better clarity and usage while allowing the namespace/module to work as normal as well.

import { Enums } from '@nativescript/core';

const left = Enums.TextAlignment.left; // works
const leftAssignment: Enums.TextAlignmentType = 'left'; // works

This also adds the additional getter/setters for plugin usage:

import { 
  letterSpacingProperty, 
  textAlignmentProperty, 
  textDecorationProperty, 
  textTransformProperty, 
  whiteSpaceProperty, 
  lineHeightProperty 
} from '@nativescript/core';

/cc @PeterStaev

@cla-bot cla-bot bot added the cla: yes label Sep 2, 2020
@NathanWalker NathanWalker force-pushed the fix/type-collisions-namespace branch 2 times, most recently from 9d6e694 to 689f2b1 Compare September 7, 2020 18:42
@NathanWalker NathanWalker force-pushed the fix/type-collisions-namespace branch from 6f862a7 to 083e696 Compare September 10, 2020 15:44
@NathanWalker NathanWalker marked this pull request as draft September 22, 2020 20:28
@NathanWalker NathanWalker force-pushed the fix/type-collisions-namespace branch from 1cb2fee to fcbecd1 Compare October 17, 2020 00:39
@NathanWalker NathanWalker force-pushed the fix/type-collisions-namespace branch 2 times, most recently from b26f471 to aa7161e Compare October 19, 2020 19:43
@NathanWalker NathanWalker added this to the 7.1 milestone Oct 27, 2020
@NathanWalker NathanWalker force-pushed the fix/type-collisions-namespace branch from aa7161e to 11155c2 Compare November 16, 2020 02:58
@NathanWalker NathanWalker marked this pull request as ready for review November 16, 2020 05:44
@NathanWalker
Copy link
Contributor Author

This has been published as an rc to begin some testing against plugins and other projects: 7.1.0-rc.0

@NathanWalker NathanWalker modified the milestones: 7.1, 8.0 Dec 26, 2020
@NathanWalker NathanWalker changed the base branch from master to release/8.0.0 January 21, 2021 17:34
@NathanWalker NathanWalker changed the base branch from release/8.0.0 to fix/feature-cleanup February 26, 2021 04:55
@NathanWalker NathanWalker merged commit 6999382 into fix/feature-cleanup Feb 26, 2021
@NathanWalker NathanWalker deleted the fix/type-collisions-namespace branch February 26, 2021 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants