1

I'm using VSCode with Vetur. This is my code:

alert({
  title: 'Success!',
  message: 'Account created successfully',
  okButtonText: 'Okay'
  }).then(() => {
  console.log('Alert dialog closed!');
})

I get the error Property 'then' does not exist on type 'void' Vetur(2339)

I just follow the instructions in the docs here: https://nativescript-vue.org/en/docs/elements/dialogs/alert/

Any idea what's going on?

Ayudh
  • 1,673
  • 1
  • 22
  • 55

1 Answers1

1

EDIT for Nativescript 7:

import {Dialogs} from "@nativescript/core";

then use

Dialogs.alert({
  foo
});

or whatever you need from the Dialogs module.

Original answer:

Make sure to either

import { alert } from 'tns-core-modules/ui/dialogs'

edit: or (thanks ayudh)

import { alert } from '@nativescript/core/ui/dialogs'
Patrick
  • 39
  • 4